iobroker.mywebui 1.37.55 → 1.37.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/io-package.json
CHANGED
package/package.json
CHANGED
|
@@ -120,6 +120,13 @@ export class IobrokerHandler {
|
|
|
120
120
|
}
|
|
121
121
|
} catch (e) { /* default 'en' */ }
|
|
122
122
|
}
|
|
123
|
+
// Initialize local_language with current browser language (per-user/browser local state)
|
|
124
|
+
this.setState('local_language', { val: this.language });
|
|
125
|
+
// When local_language changes (e.g. from user's language selector control), apply it
|
|
126
|
+
this.subscribeState('local_language', (_id, state) => {
|
|
127
|
+
if (state?.val && state.val !== this.language)
|
|
128
|
+
this.setLanguage(state.val);
|
|
129
|
+
});
|
|
123
130
|
await this.loadTranslations();
|
|
124
131
|
window.t = (key) => this.t(key);
|
|
125
132
|
for (let p of this._readyPromises)
|
|
@@ -497,6 +504,9 @@ export class IobrokerHandler {
|
|
|
497
504
|
localStorage.setItem('webui-language', lang);
|
|
498
505
|
this.languageChanged.emit(lang);
|
|
499
506
|
window.dispatchEvent(new CustomEvent('languageChanged', { detail: lang }));
|
|
507
|
+
// Keep local_language in sync so bindings/formulas can read current language
|
|
508
|
+
if (this.#localValues.get('local_language')?.val !== lang)
|
|
509
|
+
this.setState('local_language', { val: lang });
|
|
500
510
|
fetch('/mywebui-grafana-lang', {
|
|
501
511
|
method: 'POST',
|
|
502
512
|
headers: { 'Content-Type': 'application/json' },
|