diff --git a/CHANGELOG.md b/CHANGELOG.md index 82405f3..cfc4211 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi ## [Unreleased] ### Changed +- **i18n namespace migration.** Language dictionaries and mutable language state now use a private scope with compatibility + exports and a `window.TTVC.i18n` API. - **Audiobook-cast namespace migration.** Cast serialization, page stamping, and speaker normalization now use a private scope with compatibility exports and the existing `window.TTVC.audiobook.cast` API. - **SillyTavern namespace migration.** Character-card parsing, import, and export helpers now use a private scope with diff --git a/VERSION b/VERSION index 773d679..1d5543b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.24.95 +1.24.96 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 8caf280..616ea5e 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -83,6 +83,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed) - ✅ Seed-finder generation and caching helpers use a private scope with compatibility exports and a namespace API. - ✅ Audiobook cast serialization and speaker normalization use a private scope with the existing cast namespace API. - ✅ SillyTavern character-card import/export helpers use a private scope with a namespace API. +- ✅ i18n dictionaries and language state use a private scope with compatibility exports and a namespace API. - ✅ `static/css/resource-diagnostics.css` — isolated Performance/resource diagnostic panel styles. - ✅ `static/css/background-jobs.css` — isolated background-job history and retry-panel styles. - ✅ `static/css/voice-design.css` — isolated Voice Design form, samples, and preview-match styles. diff --git a/static/index.html b/static/index.html index 9f9a853..1056dd9 100644 --- a/static/index.html +++ b/static/index.html @@ -10,7 +10,7 @@ - + @@ -27,12 +27,12 @@ - - - - - - + + + + + + @@ -397,7 +397,7 @@ window.toggleNavTree = function(treeId, chevronId) { - + diff --git a/static/js/i18n.js b/static/js/i18n.js index 4915ddd..e989297 100644 --- a/static/js/i18n.js +++ b/static/js/i18n.js @@ -8,6 +8,8 @@ // window.t('English') for JS-generated strings. Dynamic lists can be translated by // calling window.applyI18n(container) after rendering. +(function (root) { + const I18N_LANGS = { en: 'English', de: 'Deutsch', fr: 'Français', es: 'Español', it: 'Italiano', pt: 'Português', nl: 'Nederlands', pl: 'Polski', @@ -481,3 +483,16 @@ window.populateLangSelect = function () { // Back-compat: loader.js calls initLangPicker() once at startup. The picker now // lives in Settings → General, so this just tries to populate it. window.initLangPicker = function () { window.populateLangSelect(); }; + +Object.assign(root, { I18N_LANGS, I18N_DICT }); +root.TTVC = root.TTVC || {}; +root.TTVC.i18n = root.TTVC.i18n || {}; +Object.assign(root.TTVC.i18n, { + languages: I18N_LANGS, + dictionary: I18N_DICT, + get language() { return _appLang; }, + translate: root.t, + apply: root.applyI18n, + set: root.setAppLang, +}); +})(window);