Fix an issue with user language setting.
This commit is contained in:
parent
5dd0efb280
commit
19db9dea30
2 changed files with 12 additions and 14 deletions
5
ui/src/components/navbar.tsx
vendored
5
ui/src/components/navbar.tsx
vendored
|
@ -31,7 +31,7 @@ import {
|
||||||
md,
|
md,
|
||||||
setTheme,
|
setTheme,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
import { i18n, i18nextSetup } from '../i18next';
|
import { i18n } from '../i18next';
|
||||||
|
|
||||||
interface NavbarState {
|
interface NavbarState {
|
||||||
isLoggedIn: boolean;
|
isLoggedIn: boolean;
|
||||||
|
@ -435,12 +435,11 @@ export class Navbar extends Component<any, NavbarState> {
|
||||||
this.requestNotificationPermission();
|
this.requestNotificationPermission();
|
||||||
this.fetchUnreads();
|
this.fetchUnreads();
|
||||||
setTheme(data.my_user.theme, true);
|
setTheme(data.my_user.theme, true);
|
||||||
|
i18n.changeLanguage(data.my_user.lang);
|
||||||
}
|
}
|
||||||
this.state.isLoggedIn = true;
|
this.state.isLoggedIn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
i18nextSetup();
|
|
||||||
|
|
||||||
this.state.siteLoading = false;
|
this.state.siteLoading = false;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
}
|
}
|
||||||
|
|
7
ui/src/i18next.ts
vendored
7
ui/src/i18next.ts
vendored
|
@ -65,8 +65,7 @@ function format(value: any, format: any, lng: any): any {
|
||||||
return format === 'uppercase' ? value.toUpperCase() : value;
|
return format === 'uppercase' ? value.toUpperCase() : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function i18nextSetup() {
|
i18next.init({
|
||||||
i18next.init({
|
|
||||||
debug: false,
|
debug: false,
|
||||||
// load: 'languageOnly',
|
// load: 'languageOnly',
|
||||||
|
|
||||||
|
@ -75,6 +74,6 @@ export function i18nextSetup() {
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
resources,
|
resources,
|
||||||
interpolation: { format },
|
interpolation: { format },
|
||||||
});
|
});
|
||||||
}
|
|
||||||
export { i18next as i18n, resources };
|
export { i18next as i18n, resources };
|
||||||
|
|
Loading…
Reference in a new issue