Merge pull request #443 from mawoka-myblock/frontend-dependency-update
This commit is contained in:
@@ -45,7 +45,7 @@ export class I18nService {
|
||||
initialize(): void {
|
||||
this.i18n.use(LanguageDetector).init({
|
||||
// lng: INITIAL_LANGUAGE,
|
||||
compatibilityJSON: 'v3',
|
||||
compatibilityJSON: 'v4',
|
||||
fallbackLng: 'en',
|
||||
debug: false,
|
||||
defaultNS: 'translation',
|
||||
@@ -61,7 +61,8 @@ export class I18nService {
|
||||
detection: {
|
||||
order: ['querystring', 'cookie', 'localStorage', 'navigator'],
|
||||
lookupQuerystring: 'lng',
|
||||
lookupLocalStorage: 'language'
|
||||
lookupLocalStorage: 'language',
|
||||
lookupSessionStorage: true
|
||||
}
|
||||
});
|
||||
this.i18n.addResourceBundle('en', 'translation', en);
|
||||
|
||||
@@ -22,15 +22,19 @@ export const getLocalization = () => {
|
||||
return getContext<I18nContext>(CONTEXT_KEY);
|
||||
};
|
||||
|
||||
export const initLocalizationContext = () => {
|
||||
export const initLocalizationContext = (start_lanugage: string): { i18n: I18nService } => {
|
||||
// Initialize our services
|
||||
const i18n = new I18nService();
|
||||
const tranlator = new I18NextTranslationService(i18n);
|
||||
|
||||
let locale: any;
|
||||
if (start_lanugage) {
|
||||
locale = start_lanugage;
|
||||
}
|
||||
tranlator.locale.set(locale);
|
||||
// skipcq: JS-0357
|
||||
setLocalization({
|
||||
t: tranlator.translate,
|
||||
currentLanguage: tranlator.locale
|
||||
currentLanguage: locale
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user