i18n is working
This commit is contained in:
parent
68e90ccd03
commit
c4c9f5d941
|
@ -407,6 +407,10 @@
|
||||||
"simpleView": "Simple View",
|
"simpleView": "Simple View",
|
||||||
"preview": "Preview"
|
"preview": "Preview"
|
||||||
},
|
},
|
||||||
|
"languages": {
|
||||||
|
"ko": "Korean",
|
||||||
|
"en": "English"
|
||||||
|
},
|
||||||
"timezone": {
|
"timezone": {
|
||||||
"Africa/Abidjan": "Africa/Abidjan",
|
"Africa/Abidjan": "Africa/Abidjan",
|
||||||
"Africa/Accra": "Africa/Accra",
|
"Africa/Accra": "Africa/Accra",
|
||||||
|
|
|
@ -407,6 +407,10 @@
|
||||||
"simpleView": "간략 보기",
|
"simpleView": "간략 보기",
|
||||||
"preview": "미리 보기"
|
"preview": "미리 보기"
|
||||||
},
|
},
|
||||||
|
"languages": {
|
||||||
|
"ko": "한국어",
|
||||||
|
"en": "영어"
|
||||||
|
},
|
||||||
"timezone": {
|
"timezone": {
|
||||||
"Africa/Abidjan": "아프리카/아비 장",
|
"Africa/Abidjan": "아프리카/아비 장",
|
||||||
"Africa/Accra": "아프리카/아크라",
|
"Africa/Accra": "아프리카/아크라",
|
||||||
|
|
|
@ -80,11 +80,11 @@
|
||||||
[value]="setting.locale"
|
[value]="setting.locale"
|
||||||
(selectionChange)="onSelectionChangeLocale($event)"
|
(selectionChange)="onSelectionChangeLocale($event)"
|
||||||
>
|
>
|
||||||
<mat-option value="ko">
|
<mat-option
|
||||||
한국어 (대한민국)
|
*ngFor="let language of languageList"
|
||||||
</mat-option>
|
[value]="language.name"
|
||||||
<mat-option value="en">
|
>
|
||||||
영어 (미국)
|
{{ language.displayName }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -99,11 +99,11 @@
|
||||||
[value]="setting.hrInfoLocale"
|
[value]="setting.hrInfoLocale"
|
||||||
(selectionChange)="onSelectionChangeHrInfoLocale($event)"
|
(selectionChange)="onSelectionChangeHrInfoLocale($event)"
|
||||||
>
|
>
|
||||||
<mat-option value="ko">
|
<mat-option
|
||||||
한국어 (대한민국)
|
*ngFor="let language of languageList"
|
||||||
</mat-option>
|
[value]="language.name"
|
||||||
<mat-option value="en">
|
>
|
||||||
영어 (미국)
|
{{ language.displayName }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<h1 mat-subheader>시간대</h1>
|
<h1 mat-subheader>{{ 'settings.genernal.timezone' | translate }}</h1>
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<mat-form-field fxFlexFill>
|
<mat-form-field fxFlexFill>
|
||||||
<mat-select
|
<mat-select
|
||||||
|
|
|
@ -29,6 +29,11 @@ export interface TimezoneData {
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface LanguageData {
|
||||||
|
displayName: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ucap-settings-general',
|
selector: 'ucap-settings-general',
|
||||||
templateUrl: './general.component.html',
|
templateUrl: './general.component.html',
|
||||||
|
@ -53,6 +58,15 @@ export class GeneralComponent implements OnInit, OnDestroy {
|
||||||
// tslint:disable-next-line: variable-name
|
// tslint:disable-next-line: variable-name
|
||||||
_timezoneList: TimezoneData[];
|
_timezoneList: TimezoneData[];
|
||||||
|
|
||||||
|
get languageList(): LanguageData[] {
|
||||||
|
return this._languageList;
|
||||||
|
}
|
||||||
|
set languageList(languageList: LanguageData[]) {
|
||||||
|
this._languageList = languageList;
|
||||||
|
}
|
||||||
|
// tslint:disable-next-line: variable-name
|
||||||
|
_languageList: LanguageData[];
|
||||||
|
|
||||||
langChangeSubscription: Subscription;
|
langChangeSubscription: Subscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -79,6 +93,7 @@ export class GeneralComponent implements OnInit, OnDestroy {
|
||||||
this.themeTabGroup.selectedIndex = themeIndex;
|
this.themeTabGroup.selectedIndex = themeIndex;
|
||||||
|
|
||||||
this.setTimezoneData();
|
this.setTimezoneData();
|
||||||
|
this.setLanguageData();
|
||||||
|
|
||||||
this.langChangeSubscription = merge(
|
this.langChangeSubscription = merge(
|
||||||
this.translateService.onLangChange,
|
this.translateService.onLangChange,
|
||||||
|
@ -86,6 +101,7 @@ export class GeneralComponent implements OnInit, OnDestroy {
|
||||||
this.translateService.onTranslationChange
|
this.translateService.onTranslationChange
|
||||||
).subscribe(() => {
|
).subscribe(() => {
|
||||||
this.setTimezoneData();
|
this.setTimezoneData();
|
||||||
|
this.setLanguageData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,10 +161,8 @@ export class GeneralComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private setTimezoneData() {
|
private setTimezoneData() {
|
||||||
this.translateService
|
const timezoneData = this.translateService.instant('common.timezone');
|
||||||
.get('common.timezone')
|
|
||||||
.pipe(take(1))
|
|
||||||
.subscribe(timezoneData => {
|
|
||||||
let timezoneList: TimezoneData[] = [];
|
let timezoneList: TimezoneData[] = [];
|
||||||
for (const name of moment.tz.names()) {
|
for (const name of moment.tz.names()) {
|
||||||
const displayName = `(UTC${moment.tz(name).format('Z')}) ${
|
const displayName = `(UTC${moment.tz(name).format('Z')}) ${
|
||||||
|
@ -164,6 +178,18 @@ export class GeneralComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.timezoneList = timezoneList;
|
this.timezoneList = timezoneList;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
private setLanguageData() {
|
||||||
|
const languageData = this.translateService.instant('common.languages');
|
||||||
|
|
||||||
|
const languageList: LanguageData[] = [];
|
||||||
|
for (const key in languageData) {
|
||||||
|
if (languageData.hasOwnProperty(key)) {
|
||||||
|
languageList.push({ displayName: languageData[key], name: key });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.languageList = languageList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user