messageToastify,
md,
setTheme,
+ getLanguage,
} from '../utils';
import { i18n } from '../i18next';
this.requestNotificationPermission();
this.fetchUnreads();
setTheme(data.my_user.theme, true);
- i18n.changeLanguage(data.my_user.lang);
+ i18n.changeLanguage(getLanguage());
}
this.state.isLoggedIn = true;
}
showAvatars,
toast,
setupTippy,
+ getLanguage,
} from '../utils';
import { UserListing } from './user-listing';
import { SortSelect } from './sort-select';
handleUserSettingsLangChange(i: User, event: any) {
i.state.userSettingsForm.lang = event.target.value;
- i18n.changeLanguage(i.state.userSettingsForm.lang);
+ i18n.changeLanguage(getLanguage(i.state.userSettingsForm.lang));
i.setState(i.state);
}
};
}
-export function getLanguage(): string {
+export function getLanguage(override: string): string {
let user = UserService.Instance.user;
- let lang = user && user.lang ? user.lang : 'browser';
+ let lang = override || (user && user.lang ? user.lang : 'browser');
if (lang == 'browser') {
return getBrowserLanguage();