jojo/modules/translation/i18n
0ko 9ccaf473eb fix(i18n): don't log harmless missing translations as errors (#12183)
Followup to https://codeberg.org/forgejo/forgejo/pulls/6203

Currently it is logging an error wherever a template is rendered in language that doesn't have all plural strings covered. For example, Esperanto isn't well maintained.

Since more plural strings were migrated in v15 to new format, these errors became much more common. However, for all languages but the base one (English) they are completely harmless and just indicate an incomplete translation.

However, for base (English) they indicate a bug in either template or en-US.json, which should be still logged as an error.

The error is being logged by `LookupPluralByForm`, which is called by `TrPluralStringAllForms` and (`TrPluralString` through `LookupPluralByCount`). I originally intended to just pass log func directly to `LookupPluralByForm` from both, but since `TrPluralString` isn't calling `LookupPluralByForm` directly, it didn't look clean, so I went with passing a flag around instead and implemented logging logic in `LookupPluralByForm` itself.

I little concern is with that the so-called "default lang" is configurable, and if it is configured to something with less than 100% completion, it will cause fallback bugs, as well as a lot of logging of this as an error. But this is why changing "default lang" is a bad idea in the first place, and broken fallbacks should be greater concern than junk in the logs.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12183
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
2026-04-18 23:18:02 +02:00
..
dummy.go Replace the 'relative-time' element scripting with custom, translatable rewrite (#6154) 2025-05-03 14:11:01 +00:00
dummy_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
errors.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
format.go Replace interface{} with any (#25686) 2023-07-04 18:36:08 +00:00
i18n.go Replace the 'relative-time' element scripting with custom, translatable rewrite (#6154) 2025-05-03 14:11:01 +00:00
i18n_ini_test.go chore(test): separate and move around i18n testing (#10539) 2025-12-23 04:39:26 +01:00
i18n_test.go chore(test): separate and move around i18n testing (#10539) 2025-12-23 04:39:26 +01:00
localestore.go fix(i18n): don't log harmless missing translations as errors (#12183) 2026-04-18 23:18:02 +02:00