Skip to content

Commit e328cd8

Browse files
committed
fix(i18n): add backward-compat un-namespaced keys for module translations
Module i18n keys are namespaced (e.g. docsight.journal.icon_auto) but existing JS code references them without prefix (T.icon_auto). Merge both namespaced and un-namespaced keys to prevent JS errors.
1 parent 37bad26 commit e328cd8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/module_loader.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ def merge_module_i18n(module_id: str, i18n_dir: str) -> None:
219219
if key.startswith("_"):
220220
continue # skip metadata keys like _meta
221221
_TRANSLATIONS[lang][f"{module_id}.{key}"] = value
222+
# Also add un-namespaced key for backward compat with JS code
223+
if key not in _TRANSLATIONS[lang]:
224+
_TRANSLATIONS[lang][key] = value
222225

223226
log.debug("Merged %d i18n keys for module '%s' lang '%s'", len(data), module_id, lang)
224227

0 commit comments

Comments
 (0)