mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-05 18:05:19 +02:00
fix(i18n): prevent incorrect logging on strings missing in JSON locales (#7594)
Fixes https://codeberg.org/forgejo/forgejo/issues/7591 Followup to https://codeberg.org/forgejo/forgejo/pulls/6203 When the test runs without an actual fix included, an error message appears in the logs: [E] Missing translation "incorrect_root_url" With it, it does not. Reported-by: Paweł Bogusławski <pboguslawski@noreply.codeberg.org> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7594 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
parent
8e0b86a5dc
commit
603d655ec4
2 changed files with 30 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package i18n
|
||||
|
@ -205,6 +206,7 @@ func (l *locale) TrString(trKey string, trArgs ...any) string {
|
|||
if defaultLang, ok := l.store.localeMap[l.store.defaultLang]; ok {
|
||||
if msg := defaultLang.LookupNewStyleMessage(trKey); msg != "" {
|
||||
format = msg
|
||||
found = true
|
||||
} else if foundIndex {
|
||||
// Third fallback: old-style default language
|
||||
if msg, ok := defaultLang.idxToMsgMap[idx]; ok {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue