From 5e5ee90df898be1b94fe5cbb4a7a0ad4f293cb54 Mon Sep 17 00:00:00 2001 From: drafish Date: Fri, 3 Feb 2023 11:14:41 +0800 Subject: [PATCH] update url params when switch locale --- apps/remix-ide/src/app/tabs/locale-module.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locale-module.js b/apps/remix-ide/src/app/tabs/locale-module.js index fd2a8dd5fb..0487f94e96 100644 --- a/apps/remix-ide/src/app/tabs/locale-module.js +++ b/apps/remix-ide/src/app/tabs/locale-module.js @@ -32,7 +32,8 @@ export class LocaleModule extends Plugin { this.locales[locale.code.toLocaleLowerCase()] = locale }) this._paq = _paq - let queryLocale = (new QueryParams()).get().locale + this.queryParams = new QueryParams() + let queryLocale = this.queryParams.get().lang queryLocale = queryLocale && queryLocale.toLocaleLowerCase() queryLocale = this.locales[queryLocale] ? queryLocale : null let currentLocale = (this._deps.config && this._deps.config.get('settings/locale')) || null @@ -41,6 +42,7 @@ export class LocaleModule extends Plugin { this.currentLocaleState = { queryLocale, currentLocale } this.active = queryLocale || currentLocale || 'en' this.forced = !!queryLocale + this.queryParams.update({ lang: this.active }) } /** Return the active locale */ @@ -69,6 +71,7 @@ export class LocaleModule extends Plugin { if (!this.forced) this._deps.config.set('settings/locale', next) if (localeCode) this.active = localeCode + this.queryParams.update({ lang: localeCode }) this.emit('localeChanged', nextLocale) this.events.emit('localeChanged', nextLocale) }