diff --git a/js/src/components/Footer.vue b/js/src/components/Footer.vue
index 657b4cae2..50d4eaf7f 100644
--- a/js/src/components/Footer.vue
+++ b/js/src/components/Footer.vue
@@ -2,6 +2,17 @@
diff --git a/js/src/utils/auth.ts b/js/src/utils/auth.ts
index 4af15e4d5..52354432a 100644
--- a/js/src/utils/auth.ts
+++ b/js/src/utils/auth.ts
@@ -32,6 +32,10 @@ export function saveLocaleData(locale: string): void {
localStorage.setItem(USER_LOCALE, locale);
}
+export function getLocaleData(): string | null {
+ return localStorage.getItem(USER_LOCALE);
+}
+
export function saveActorData(obj: IPerson): void {
localStorage.setItem(AUTH_USER_ACTOR_ID, `${obj.id}`);
}
diff --git a/js/src/utils/i18n.ts b/js/src/utils/i18n.ts
index e9a1c9f01..06f722087 100644
--- a/js/src/utils/i18n.ts
+++ b/js/src/utils/i18n.ts
@@ -1,26 +1,30 @@
import Vue from "vue";
import VueI18n from "vue-i18n";
import { DateFnsPlugin } from "@/plugins/dateFns";
-import { USER_LOCALE } from "@/constants";
import en from "../i18n/en_US.json";
import langs from "../i18n/langs.json";
+import { getLocaleData } from "./auth";
const DEFAULT_LOCALE = "en_US";
let language =
- localStorage.getItem(USER_LOCALE) ||
- (document.documentElement.getAttribute("lang") as string);
+ getLocaleData() || (document.documentElement.getAttribute("lang") as string);
+console.log("lang1", language);
+
language =
language ||
((window.navigator as any).userLanguage || window.navigator.language).replace(
/-/,
"_"
);
+console.log("language2", language);
+
export const locale =
language && Object.prototype.hasOwnProperty.call(langs, language)
? language
: language.split("-")[0];
+console.log("lang3", locale);
Vue.use(VueI18n);
export const i18n = new VueI18n({
@@ -29,6 +33,7 @@ export const i18n = new VueI18n({
// @ts-ignore
messages: en, // set locale messages
fallbackLocale: DEFAULT_LOCALE,
+ formatFallbackMessages: true,
});
const loadedLanguages = [DEFAULT_LOCALE];