国际化

This commit is contained in:
John
2024-03-10 12:04:23 +08:00
parent 44e109ae4b
commit b734a72fc6
7 changed files with 217 additions and 39 deletions

View File

@@ -18,17 +18,19 @@
<script setup lang="ts">
import { getDefaultLocal } from '@/api/system/user';
const lang = localStorage.getItem('lang')
if (!lang) {
const _getDefaultLocal = () => {
getDefaultLocal().then(res => {
console.log('res', res)
if (res === 'gu_IN') {
localStorage.setItem('lang', 'hi')
} else {
localStorage.setItem('lang', 'zh')
if (lang !== res) {
localStorage.setItem('lang', res)
location.reload()
}
location.reload()
})
}
_getDefaultLocal()
</script>
<style>