From: Dessalines Date: Wed, 29 Jul 2020 13:05:46 +0000 (-0400) Subject: Fix an issue with user language setting. X-Git-Url: http://these/git/%22https:/image.com/readmes/%7B%60%24%7BarchiveUrl%7D/static/%7Brss%7D?a=commitdiff_plain;h=19db9dea30a97eac473b14bbae6a3a675539db25;p=lemmy.git Fix an issue with user language setting. --- diff --git a/ui/src/components/navbar.tsx b/ui/src/components/navbar.tsx index 561dc482..2986ce7e 100644 --- a/ui/src/components/navbar.tsx +++ b/ui/src/components/navbar.tsx @@ -31,7 +31,7 @@ import { md, setTheme, } from '../utils'; -import { i18n, i18nextSetup } from '../i18next'; +import { i18n } from '../i18next'; interface NavbarState { isLoggedIn: boolean; @@ -435,12 +435,11 @@ export class Navbar extends Component { this.requestNotificationPermission(); this.fetchUnreads(); setTheme(data.my_user.theme, true); + i18n.changeLanguage(data.my_user.lang); } this.state.isLoggedIn = true; } - i18nextSetup(); - this.state.siteLoading = false; this.setState(this.state); } diff --git a/ui/src/i18next.ts b/ui/src/i18next.ts index 5d68b180..3657da33 100644 --- a/ui/src/i18next.ts +++ b/ui/src/i18next.ts @@ -65,16 +65,15 @@ function format(value: any, format: any, lng: any): any { return format === 'uppercase' ? value.toUpperCase() : value; } -export function i18nextSetup() { - i18next.init({ - debug: false, - // load: 'languageOnly', +i18next.init({ + debug: false, + // load: 'languageOnly', + + // initImmediate: false, + lng: getLanguage(), + fallbackLng: 'en', + resources, + interpolation: { format }, +}); - // initImmediate: false, - lng: getLanguage(), - fallbackLng: 'en', - resources, - interpolation: { format }, - }); -} export { i18next as i18n, resources };