diff --git a/apps/datafeeder/src/app/app.module.ts b/apps/datafeeder/src/app/app.module.ts index 62ee568633..f48617a8a7 100644 --- a/apps/datafeeder/src/app/app.module.ts +++ b/apps/datafeeder/src/app/app.module.ts @@ -10,8 +10,6 @@ import { AppRoutingModule } from './app-routing.module' import { AppComponent } from './app.component' import { UploadDataComponent } from './presentation/components/upload-data/upload-data.component' import { - getDefaultLang, - getLangFromBrowser, TRANSLATE_DEFAULT_CONFIG, UtilI18nModule, } from '@geonetwork-ui/util/i18n' @@ -19,7 +17,7 @@ import { UiInputsModule } from '@geonetwork-ui/ui/inputs' import { UploadDataPageComponent } from './presentation/pages/upload-data-page/upload-data.page' import { UploadDataRulesComponent } from './presentation/components/upload-data-rules/upload-data-rules.component' import { HttpClientModule } from '@angular/common/http' -import { TranslateModule, TranslateService } from '@ngx-translate/core' +import { TranslateModule } from '@ngx-translate/core' import { DatasetValidationPageComponent } from './presentation/pages/dataset-validation-page/dataset-validation-page' import { DataImportValidationMapPanelComponent } from './presentation/components/data-import-validation-map-panel/data-import-validation-map-panel.component' import { AnalysisProgressPageComponent } from './presentation/pages/analysis-progress-page/analysis-progress.page' @@ -84,8 +82,4 @@ export function apiConfigurationFactory() { ], bootstrap: [AppComponent], }) -export class AppModule { - constructor(translate: TranslateService) { - translate.use(getLangFromBrowser() || getDefaultLang()) - } -} +export class AppModule {} diff --git a/apps/datahub/src/app/app.module.ts b/apps/datahub/src/app/app.module.ts index b3305bbaee..0eadf503cb 100644 --- a/apps/datahub/src/app/app.module.ts +++ b/apps/datahub/src/app/app.module.ts @@ -27,8 +27,6 @@ import { getThemeConfig, } from '@geonetwork-ui/util/app-config' import { - getDefaultLang, - getLangFromBrowser, TRANSLATE_DEFAULT_CONFIG, UtilI18nModule, } from '@geonetwork-ui/util/i18n' @@ -43,7 +41,7 @@ import { LOGIN_URL } from '@geonetwork-ui/feature/auth' import { EffectsModule } from '@ngrx/effects' import { MetaReducer, StoreModule } from '@ngrx/store' import { StoreDevtoolsModule } from '@ngrx/store-devtools' -import { TranslateModule, TranslateService } from '@ngx-translate/core' +import { TranslateModule } from '@ngx-translate/core' import { filter } from 'rxjs/operators' import { environment } from '../environments/environment' @@ -165,13 +163,7 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : [] bootstrap: [AppComponent], }) export class AppModule { - constructor( - translate: TranslateService, - router: Router, - @Inject(DOCUMENT) private document: Document - ) { - translate.setDefaultLang(getDefaultLang()) - translate.use(getLangFromBrowser() || getDefaultLang()) + constructor(router: Router, @Inject(DOCUMENT) private document: Document) { ThemeService.applyCssVariables( getThemeConfig().PRIMARY_COLOR, getThemeConfig().SECONDARY_COLOR, diff --git a/apps/search/src/app/app.module.ts b/apps/search/src/app/app.module.ts index f5a3b0f837..b5f3520a3d 100644 --- a/apps/search/src/app/app.module.ts +++ b/apps/search/src/app/app.module.ts @@ -7,7 +7,6 @@ import { FeatureMapModule } from '@geonetwork-ui/feature/map' import { UiLayoutModule } from '@geonetwork-ui/ui/layout' import { UiMapModule } from '@geonetwork-ui/ui/map' import { - getDefaultLang, UtilI18nModule, TRANSLATE_GEONETWORK_CONFIG, } from '@geonetwork-ui/util/i18n' @@ -16,7 +15,7 @@ import { FeatureSearchModule } from '@geonetwork-ui/feature/search' import { EffectsModule } from '@ngrx/effects' import { MetaReducer, StoreModule } from '@ngrx/store' import { StoreDevtoolsModule } from '@ngrx/store-devtools' -import { TranslateModule, TranslateService } from '@ngx-translate/core' +import { TranslateModule } from '@ngx-translate/core' import { storeFreeze } from 'ngrx-store-freeze' import { environment } from '../environments/environment' import { AppRoutingModule } from './app-routing.module' @@ -57,10 +56,4 @@ export const metaReducers: MetaReducer[] = !environment.production ], bootstrap: [AppComponent], }) -export class AppModule { - constructor(translate: TranslateService) { - const lang = getDefaultLang() - translate.setDefaultLang(lang) - translate.use(lang) - } -} +export class AppModule {} diff --git a/libs/util/i18n/src/lib/util-i18n.module.ts b/libs/util/i18n/src/lib/util-i18n.module.ts index f40512a813..7ef1b5e7b8 100644 --- a/libs/util/i18n/src/lib/util-i18n.module.ts +++ b/libs/util/i18n/src/lib/util-i18n.module.ts @@ -2,7 +2,7 @@ import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http' import { NgModule } from '@angular/core' import { ApiModule } from '@geonetwork-ui/data-access/gn4' import { TranslateModule, TranslateService } from '@ngx-translate/core' -import { DEFAULT_LANG } from './i18n.constants' +import { getDefaultLang } from './i18n.constants' import { I18nInterceptor } from './i18n.interceptor' import { CommonModule } from '@angular/common' @@ -20,7 +20,7 @@ import { CommonModule } from '@angular/common' }) export class UtilI18nModule { constructor(translate: TranslateService) { - translate.setDefaultLang(DEFAULT_LANG) - translate.use(DEFAULT_LANG) + translate.setDefaultLang(getDefaultLang()) + translate.use(translate.getBrowserLang() || getDefaultLang()) } }