🌐 Added French
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user