mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
refactor: i18n for settings module
This commit is contained in:
@@ -20,6 +20,7 @@ import {ThingPropertyNameTranslatePipe, ThingTranslatePipe} from './thing-transl
|
||||
import {ThingTranslateService} from './thing-translate.service';
|
||||
|
||||
|
||||
// tslint:disable: completed-docs
|
||||
export interface ThingTranslateModuleConfig {
|
||||
parser?: Provider;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
import {Injectable, OnDestroy} from '@angular/core';
|
||||
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
|
||||
import {SCLanguage, SCThings, SCThingTranslator, SCThingType, SCTranslations} from '@openstapps/core';
|
||||
import moment from 'moment';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {isDefined, ThingTranslateParser} from './thing-translate.parser';
|
||||
|
||||
@@ -41,10 +42,12 @@ export class ThingTranslateService implements OnDestroy {
|
||||
public parser: ThingTranslateParser){
|
||||
|
||||
this.translator = new SCThingTranslator('de' ?? this.translateService.currentLang as keyof SCTranslations<SCLanguage>);
|
||||
moment.updateLocale(this.translator.language);
|
||||
|
||||
/** set the default language from configuration */
|
||||
this.onLangChange = this.translateService.onLangChange.subscribe((event: LangChangeEvent) => {
|
||||
this.translator.language = event.lang as keyof SCTranslations<SCLanguage>;
|
||||
moment.updateLocale(event.lang);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user