From 989c49152b30d52de8f242c7fe65cc89aef9e203 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 2 Aug 2018 09:30:33 -0400 Subject: [PATCH] register locale ids --- src/popup/app.module.ts | 63 +++++++++++++++++++++++++++ src/popup/services/services.module.ts | 6 +++ 2 files changed, 69 insertions(+) diff --git a/src/popup/app.module.ts b/src/popup/app.module.ts index 8a3c4fddad..bd6f78ed94 100644 --- a/src/popup/app.module.ts +++ b/src/popup/app.module.ts @@ -61,6 +61,69 @@ import { PopOutComponent } from './components/pop-out.component'; import { IconComponent } from 'jslib/angular/components/icon.component'; +import { registerLocaleData } from '@angular/common'; +import localeBg from '@angular/common/locales/bg'; +import localeCs from '@angular/common/locales/cs'; +import localeDa from '@angular/common/locales/da'; +import localeDe from '@angular/common/locales/de'; +import localeEs from '@angular/common/locales/es'; +import localeEt from '@angular/common/locales/et'; +import localeFa from '@angular/common/locales/fa'; +import localeFi from '@angular/common/locales/fi'; +import localeFr from '@angular/common/locales/fr'; +import localeHr from '@angular/common/locales/hr'; +import localeHu from '@angular/common/locales/hu'; +import localeId from '@angular/common/locales/id'; +import localeIt from '@angular/common/locales/it'; +import localeJa from '@angular/common/locales/ja'; +import localeKo from '@angular/common/locales/ko'; +import localeNb from '@angular/common/locales/nb'; +import localeNl from '@angular/common/locales/nl'; +import localePl from '@angular/common/locales/pl'; +import localePtBr from '@angular/common/locales/pt'; +import localePtPt from '@angular/common/locales/pt-PT'; +import localeRo from '@angular/common/locales/ro'; +import localeRu from '@angular/common/locales/ru'; +import localeSk from '@angular/common/locales/sk'; +import localeSv from '@angular/common/locales/sv'; +import localeTh from '@angular/common/locales/th'; +import localeTr from '@angular/common/locales/tr'; +import localeUk from '@angular/common/locales/uk'; +import localeVi from '@angular/common/locales/vi'; +import localeZhCn from '@angular/common/locales/zh-Hans'; +import localeZhTw from '@angular/common/locales/zh-Hant'; + +registerLocaleData(localeBg, 'bg'); +registerLocaleData(localeCs, 'cs'); +registerLocaleData(localeDa, 'da'); +registerLocaleData(localeDe, 'de'); +registerLocaleData(localeEs, 'es'); +registerLocaleData(localeEt, 'et'); +registerLocaleData(localeFa, 'fa'); +registerLocaleData(localeFi, 'fi'); +registerLocaleData(localeFr, 'fr'); +registerLocaleData(localeHr, 'hr'); +registerLocaleData(localeHu, 'hu'); +registerLocaleData(localeId, 'id'); +registerLocaleData(localeIt, 'it'); +registerLocaleData(localeJa, 'ja'); +registerLocaleData(localeKo, 'ko'); +registerLocaleData(localeNb, 'nb'); +registerLocaleData(localeNl, 'nl'); +registerLocaleData(localePl, 'pl'); +registerLocaleData(localePtBr, 'pt-BR'); +registerLocaleData(localePtPt, 'pt-PT'); +registerLocaleData(localeRo, 'ro'); +registerLocaleData(localeRu, 'ru'); +registerLocaleData(localeSk, 'sk'); +registerLocaleData(localeSv, 'sv'); +registerLocaleData(localeTh, 'th'); +registerLocaleData(localeTr, 'tr'); +registerLocaleData(localeUk, 'uk'); +registerLocaleData(localeVi, 'vi'); +registerLocaleData(localeZhCn, 'zh-CN'); +registerLocaleData(localeZhTw, 'zh-TW'); + @NgModule({ imports: [ BrowserModule, diff --git a/src/popup/services/services.module.ts b/src/popup/services/services.module.ts index ffeb993aa5..aba7539282 100644 --- a/src/popup/services/services.module.ts +++ b/src/popup/services/services.module.ts @@ -1,5 +1,6 @@ import { APP_INITIALIZER, + LOCALE_ID, NgModule, } from '@angular/core'; @@ -145,6 +146,11 @@ export function initFactory(i18nService: I18nService, storageService: StorageSer deps: [I18nService, StorageService, PopupUtilsService], multi: true, }, + { + provide: LOCALE_ID, + useFactory: () => getBgService('i18nService')().translationLocale, + deps: [], + }, ], }) export class ServicesModule {