Skip to content

Commit

Permalink
Merge pull request #15 from beclab/feat/i18n
Browse files Browse the repository at this point in the history
fix: Support language meta
  • Loading branch information
wushuangs authored Sep 5, 2024
2 parents 3d852f6 + 2ad80b3 commit ffb8bc2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import { defineComponent, onMounted } from 'vue';
import { useTokenStore } from './stores/token';
import { CurrentView } from 'src/constants/index';
import { supportLanguages } from './i18n';
import { i18n } from './boot/i18n';
import queryString from 'query-string';
export default defineComponent({
Expand Down Expand Up @@ -53,6 +54,23 @@ export default defineComponent({
}
});
let terminusLanguage = '';
let terminusLanguageInfo = document.querySelector(
'meta[name="terminus-language"]'
);
if (terminusLanguageInfo && terminusLanguageInfo.content) {
terminusLanguage = terminusLanguageInfo.content;
} else {
terminusLanguage = navigator.language;
}
console.log(navigator.language);
if (terminusLanguage) {
if (supportLanguages.find((e) => e.value == terminusLanguage)) {
i18n.global.locale.value = terminusLanguage;
}
}
return {};
}
});
Expand Down

0 comments on commit ffb8bc2

Please sign in to comment.