fix(webapp): merge bundled FALLBACK_I18N with server locales
The bot's locales/*.json files do not contain the webapp-specific keys (connect, extend_subscription, loading, etc.), so applyI18n was overwriting the localized HTML defaults with raw key names. Merge the bundled FALLBACK_I18N table with whatever the server provides per language, letting server values override but falling back to the in-bundle translations for keys the bot does not ship.
This commit is contained in:
@@ -436,7 +436,15 @@ const MOCK = (() => {
|
||||
referral_bonus_explanation: 'Bonuses are awarded once for each invited user when they purchase a subscription.'
|
||||
}
|
||||
};
|
||||
const I18N = readJsonScript('i18n') || (MOCK && MOCK.i18n) || {};
|
||||
const I18N = (function () {
|
||||
const server = readJsonScript('i18n') || (MOCK && MOCK.i18n) || {};
|
||||
const merged = {};
|
||||
const langs = new Set(Object.keys(FALLBACK_I18N).concat(Object.keys(server)));
|
||||
langs.forEach(function (lang) {
|
||||
merged[lang] = Object.assign({}, FALLBACK_I18N[lang] || {}, server[lang] || {});
|
||||
});
|
||||
return merged;
|
||||
})();
|
||||
|
||||
const accent = CFG.primaryColor || '#00fe7a';
|
||||
document.documentElement.style.setProperty('--accent', accent);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user