Skip to content

Commit

Permalink
perf: 切换zh hant
Browse files Browse the repository at this point in the history
  • Loading branch information
feng626 committed Apr 10, 2024
1 parent c00ad88 commit be6befe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/app/elements/nav/nav.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ export class ElementNavComponent implements OnInit {
},
name: '中文'
},
{
id: 'Chinese-hant',
click: () => {
this._i18n.use('zh-hant');
},
name: '中文(繁體)'
},
{
id: 'Japanese',
click: () => {
Expand Down
6 changes: 5 additions & 1 deletion src/app/services/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {CookieService} from 'ngx-cookie-service';
@Injectable()
export class I18nService {
LANG_COOKIE_NAME = 'django_language';
SUPPORTED_LANG_CODES = ['en', 'zh', 'ja'];
SUPPORTED_LANG_CODES = ['en', 'zh', 'ja', 'zh-hant'];

constructor(
private _translate: TranslateService,
Expand All @@ -26,6 +26,8 @@ export class I18nService {
return 'en';
} else if (langCode.indexOf('ja') > -1) {
return 'ja';
} else if (langCode.indexOf('zh-hant') > -1) {
return 'zh-hant';
} else {
return 'zh';
}
Expand Down Expand Up @@ -60,6 +62,8 @@ export class I18nService {
useLang = 'en';
} else if (lang.indexOf('ja') > -1) {
useLang = 'ja';
} else if (lang.indexOf('zh-hant') > -1) {
useLang = 'zh-hant';
} else {
useLang = 'zh-hans';
}
Expand Down
File renamed without changes.

0 comments on commit be6befe

Please sign in to comment.