Add variable defining default locale as english (#4406)
This commit is contained in:
parent
6d2a2aa852
commit
afcedbaf25
|
@ -7,6 +7,7 @@ export class I18nService implements I18nServiceAbstraction {
|
||||||
locale$: Observable<string> = this._locale.asObservable();
|
locale$: Observable<string> = this._locale.asObservable();
|
||||||
// First locale is the default (English)
|
// First locale is the default (English)
|
||||||
supportedTranslationLocales: string[] = ["en"];
|
supportedTranslationLocales: string[] = ["en"];
|
||||||
|
defaultLocale = "en";
|
||||||
translationLocale: string;
|
translationLocale: string;
|
||||||
collator: Intl.Collator;
|
collator: Intl.Collator;
|
||||||
localeNames = new Map<string, string>([
|
localeNames = new Map<string, string>([
|
||||||
|
@ -106,14 +107,14 @@ export class I18nService implements I18nServiceAbstraction {
|
||||||
this.translationLocale = this.translationLocale.slice(0, 2);
|
this.translationLocale = this.translationLocale.slice(0, 2);
|
||||||
|
|
||||||
if (this.supportedTranslationLocales.indexOf(this.translationLocale) === -1) {
|
if (this.supportedTranslationLocales.indexOf(this.translationLocale) === -1) {
|
||||||
this.translationLocale = this.supportedTranslationLocales[0];
|
this.translationLocale = this.defaultLocale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.localesDirectory != null) {
|
if (this.localesDirectory != null) {
|
||||||
await this.loadMessages(this.translationLocale, this.localeMessages);
|
await this.loadMessages(this.translationLocale, this.localeMessages);
|
||||||
if (this.translationLocale !== this.supportedTranslationLocales[0]) {
|
if (this.translationLocale !== this.defaultLocale) {
|
||||||
await this.loadMessages(this.supportedTranslationLocales[0], this.defaultMessages);
|
await this.loadMessages(this.defaultLocale, this.defaultMessages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue