From afcedbaf25e14a50e09fc5e9d1eb14c59d1b9ffc Mon Sep 17 00:00:00 2001 From: Robyn MacCallum Date: Mon, 23 Jan 2023 10:39:44 -0500 Subject: [PATCH] Add variable defining default locale as english (#4406) --- libs/common/src/services/i18n.service.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/common/src/services/i18n.service.ts b/libs/common/src/services/i18n.service.ts index 9fd39b092a..ce88f7f706 100644 --- a/libs/common/src/services/i18n.service.ts +++ b/libs/common/src/services/i18n.service.ts @@ -7,6 +7,7 @@ export class I18nService implements I18nServiceAbstraction { locale$: Observable = this._locale.asObservable(); // First locale is the default (English) supportedTranslationLocales: string[] = ["en"]; + defaultLocale = "en"; translationLocale: string; collator: Intl.Collator; localeNames = new Map([ @@ -106,14 +107,14 @@ export class I18nService implements I18nServiceAbstraction { this.translationLocale = this.translationLocale.slice(0, 2); if (this.supportedTranslationLocales.indexOf(this.translationLocale) === -1) { - this.translationLocale = this.supportedTranslationLocales[0]; + this.translationLocale = this.defaultLocale; } } if (this.localesDirectory != null) { await this.loadMessages(this.translationLocale, this.localeMessages); - if (this.translationLocale !== this.supportedTranslationLocales[0]) { - await this.loadMessages(this.supportedTranslationLocales[0], this.defaultMessages); + if (this.translationLocale !== this.defaultLocale) { + await this.loadMessages(this.defaultLocale, this.defaultMessages); } } }