Nice catch, we seem to have a few translations that aren’t dynamically modifiable via the Site Text feature because they’re backed in the JS bundle instead of being lazily evaluated at runtime.
I have a draft PR but I need to ensure it’s not breaking any of the plugins / themes
main ← fix-module-level-i18n-calls
closed 03:14PM - 27 Feb 26 UTC
Translation overrides (Site Text customizations) never apply to JS code that cal… ls i18n() at module evaluation time. This is because ES modules evaluate before the `localization` instance-initializer merges overrides from `I18n._overrides` into `I18n.translations`.
This change moves `i18n()` calls to be resolved lazily at render time, when overrides have already been merged:
- random-quick-tip.gjs: Store translation keys in `DEFAULT_QUICK_TIPS` and resolve them via `tipLabel`/`tipDescription` getters. Maintains backward compatibility for plugins using `addQuickSearchRandomTip()`.
- keyboard-shortcuts-help.gjs: Move modifier key translations into `getModifierKeys()` helper called from the shortcuts getter.
- template-form-fields.js: Convert exported const to a function that returns fresh translations on each call.
- Preferences controllers: Convert `subpageTitle` class properties to getters across all 8 preference controllers.
https://meta.discourse.org/t/393096
2 Likes