mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-26 18:48:02 +01:00
Lowercase language names.
This commit is contained in:
parent
04f1c8e625
commit
ed11d23e40
@ -15,6 +15,7 @@ export class AppComponent {
|
||||
private translate: TranslateService,
|
||||
private cookie: CookieService,
|
||||
private session: SessionService) {
|
||||
|
||||
translate.addLangs(supportedLangs);
|
||||
translate.setDefaultLang(enLang);
|
||||
|
||||
@ -22,9 +23,9 @@ export class AppComponent {
|
||||
let langSetting = this.cookie.get("harbor-lang");
|
||||
if (!langSetting || langSetting.trim() === "") {
|
||||
//Use browser lang
|
||||
langSetting = translate.getBrowserCultureLang();
|
||||
langSetting = translate.getBrowserCultureLang().toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
let selectedLang = this.isLangMatch(langSetting, supportedLangs) ? langSetting : enLang;
|
||||
translate.use(selectedLang);
|
||||
//this.session.switchLanguage(selectedLang).catch(error => console.error(error));
|
||||
|
@ -18,8 +18,8 @@
|
||||
<clr-icon shape="caret down"></clr-icon>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a href="javascript:void(0)" clrDropdownItem (click)='switchLanguage("en-US")' [class.lang-selected]='matchLang("en")'>English</a>
|
||||
<a href="javascript:void(0)" clrDropdownItem (click)='switchLanguage("zh-CN")' [class.lang-selected]='matchLang("zh")'>中文简体</a>
|
||||
<a href="javascript:void(0)" clrDropdownItem (click)='switchLanguage("en-us")' [class.lang-selected]='matchLang("en")'>English</a>
|
||||
<a href="javascript:void(0)" clrDropdownItem (click)='switchLanguage("zh-cn")' [class.lang-selected]='matchLang("zh")'>中文简体</a>
|
||||
</div>
|
||||
</clr-dropdown>
|
||||
<clr-dropdown [clrMenuPosition]="'bottom-right'" class="dropdown" *ngIf="isSessionValid">
|
||||
|
@ -135,7 +135,9 @@ export class NavigatorComponent implements OnInit {
|
||||
//TODO:
|
||||
console.error('Language ' + lang.trim() + ' is not suppoted');
|
||||
}
|
||||
window.location.reload();
|
||||
setTimeout(()=>{
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
//Handle the home action
|
||||
|
@ -1,8 +1,8 @@
|
||||
export const supportedLangs = ['en-US', 'zh-CN'];
|
||||
export const enLang = "en-US";
|
||||
export const supportedLangs = ['en-us', 'zh-cn'];
|
||||
export const enLang = "en-us";
|
||||
export const languageNames = {
|
||||
"en-US": "English",
|
||||
"zh-CN": "中文简体"
|
||||
"en-us": "English",
|
||||
"zh-cn": "中文简体"
|
||||
};
|
||||
export const enum AlertType {
|
||||
DANGER, WARNING, INFO, SUCCESS
|
||||
|
Loading…
Reference in New Issue
Block a user