🌐 Added French

This commit is contained in:
Mawoka
2022-04-08 15:21:23 +02:00
parent 9f1e563146
commit 7199000e74
2 changed files with 106 additions and 112 deletions
+4 -10
View File
@@ -2,6 +2,7 @@ import i18next from 'i18next';
import translations from './translations'; import translations from './translations';
import en from './locales/en.json'; import en from './locales/en.json';
import de from './locales/de.json'; import de from './locales/de.json';
import fr from './locales/fr.json';
import LanguageDetector from 'i18next-browser-languagedetector'; import LanguageDetector from 'i18next-browser-languagedetector';
import type { i18n, Resource } from 'i18next'; import type { i18n, Resource } from 'i18next';
@@ -9,6 +10,7 @@ import type { i18n, Resource } from 'i18next';
export class I18nService { export class I18nService {
// expose i18next // expose i18next
i18n: i18n; i18n: i18n;
constructor() { constructor() {
this.i18n = i18next; this.i18n = i18next;
this.initialize(); this.initialize();
@@ -38,22 +40,14 @@ export class I18nService {
// lookupQuerystring: 'lng' // lookupQuerystring: 'lng'
// } // }
detection: { detection: {
order: [ order: ['querystring', 'cookie', 'localStorage', 'navigator'],
'querystring',
'cookie',
'localStorage',
'sessionStorage',
'navigator',
'htmlTag',
'path',
'subdomain'
],
lookupQuerystring: 'lng', lookupQuerystring: 'lng',
lookupLocalStorage: 'language' lookupLocalStorage: 'language'
} }
}); });
this.i18n.addResourceBundle('en', 'translation', en); this.i18n.addResourceBundle('en', 'translation', en);
this.i18n.addResourceBundle('de', 'translation', de); this.i18n.addResourceBundle('de', 'translation', de);
this.i18n.addResourceBundle('fr', 'translation', fr);
} }
changeLanguage(language: string) { changeLanguage(language: string) {