diff --git a/src/ui_ng/src/app/app.component.ts b/src/ui_ng/src/app/app.component.ts
index 5273bcb36..917980eca 100644
--- a/src/ui_ng/src/app/app.component.ts
+++ b/src/ui_ng/src/app/app.component.ts
@@ -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));
diff --git a/src/ui_ng/src/app/base/navigator/navigator.component.html b/src/ui_ng/src/app/base/navigator/navigator.component.html
index a83279998..f64098287 100644
--- a/src/ui_ng/src/app/base/navigator/navigator.component.html
+++ b/src/ui_ng/src/app/base/navigator/navigator.component.html
@@ -18,8 +18,8 @@
diff --git a/src/ui_ng/src/app/base/navigator/navigator.component.ts b/src/ui_ng/src/app/base/navigator/navigator.component.ts
index 7f33bebca..ff58b090e 100644
--- a/src/ui_ng/src/app/base/navigator/navigator.component.ts
+++ b/src/ui_ng/src/app/base/navigator/navigator.component.ts
@@ -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
diff --git a/src/ui_ng/src/app/shared/shared.const.ts b/src/ui_ng/src/app/shared/shared.const.ts
index d058f14e6..8eae58f07 100644
--- a/src/ui_ng/src/app/shared/shared.const.ts
+++ b/src/ui_ng/src/app/shared/shared.const.ts
@@ -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
diff --git a/src/ui_ng/src/i18n/lang/en-US-lang.json b/src/ui_ng/src/i18n/lang/en-us-lang.json
similarity index 100%
rename from src/ui_ng/src/i18n/lang/en-US-lang.json
rename to src/ui_ng/src/i18n/lang/en-us-lang.json
diff --git a/src/ui_ng/src/i18n/lang/zh-CN-lang.json b/src/ui_ng/src/i18n/lang/zh-cn-lang.json
similarity index 100%
rename from src/ui_ng/src/i18n/lang/zh-CN-lang.json
rename to src/ui_ng/src/i18n/lang/zh-cn-lang.json