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