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:
3252a8
2026-04-27 09:42:18 +03:00
parent f416b0aed1
commit c1b7ace876
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -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);