diff --git a/libs/designsystem/shared/src/translation/translation.service.ts b/libs/designsystem/shared/src/translation/translation.service.ts index dccccda146..d39ff8ec39 100644 --- a/libs/designsystem/shared/src/translation/translation.service.ts +++ b/libs/designsystem/shared/src/translation/translation.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Inject, LOCALE_ID } from '@angular/core'; import { da } from './translations/da'; -import { enUS } from './translations/en-us'; +import { en } from './translations/en'; import { Translation } from './translation.interface'; @Injectable({ @@ -10,20 +10,21 @@ import { Translation } from './translation.interface'; export class TranslationService { private translations: { [key: string]: Translation } = { da, - 'en-US': enUS, + en, }; - public currentTranslation: Translation = enUS; + public currentTranslation: Translation = en; constructor(@Inject(LOCALE_ID) private localeId: string) { this.setCurrentTranslation(localeId); } setCurrentTranslation(localeId: string): string { - const translation = this.translations[localeId]; + const baseLocaleId = localeId.split('-')[0]; + const translation = this.translations[baseLocaleId]; if (!translation) { - console.warn(`Translation not found for locale "${this.localeId}", falling back to "en-US"`); + console.warn(`Translation not found for locale "${this.localeId}", falling back to "en"`); return; } diff --git a/libs/designsystem/shared/src/translation/translations/en-gb.ts b/libs/designsystem/shared/src/translation/translations/en-gb.ts deleted file mode 100644 index bb1bb77e82..0000000000 --- a/libs/designsystem/shared/src/translation/translations/en-gb.ts +++ /dev/null @@ -1,12 +0,0 @@ -// TODO: Duplicate translation to anticipate differences between en-gb and en-us, or point to the same? -import { Translation } from '../translation.interface'; - -export const enGB: Translation = { - back: 'Back', - close: 'Close', - nextMonth: 'Next month', - nextSlide: 'Next slide', - previousMonth: 'Previous month', - previousSlide: 'Previous slide', - selectYear: 'Select year', -}; diff --git a/libs/designsystem/shared/src/translation/translations/en-us.ts b/libs/designsystem/shared/src/translation/translations/en.ts similarity index 87% rename from libs/designsystem/shared/src/translation/translations/en-us.ts rename to libs/designsystem/shared/src/translation/translations/en.ts index be863e7f68..e36ef5b0ca 100644 --- a/libs/designsystem/shared/src/translation/translations/en-us.ts +++ b/libs/designsystem/shared/src/translation/translations/en.ts @@ -1,6 +1,6 @@ import { Translation } from '../translation.interface'; -export const enUS: Translation = { +export const en: Translation = { back: 'Back', close: 'Close', nextMonth: 'Next month',