fix: store language properly (#2891)

This commit is contained in:
Alex Inkin
2025-04-23 20:17:18 +07:00
committed by GitHub
parent c85ea7d8fa
commit 5b173315f9

View File

@@ -13,18 +13,24 @@ export class i18nService extends TuiLanguageSwitcherService {
readonly loading = signal(false)
override setLanguage(language: TuiLanguageName = 'english'): void {
if (this.language === language) {
return
}
const current = this.language
super.setLanguage(language)
this.loading.set(true)
this.store(language).then(() =>
if (current === language) {
this.i18nLoader(language).then(value => {
this.i18n.set(value)
this.loading.set(false)
}),
)
})
} else {
this.store(language).then(() =>
this.i18nLoader(language).then(value => {
this.i18n.set(value)
this.loading.set(false)
}),
)
}
}
}