Skip to content

Commit 5b56334

Browse files
committed
chore: update
1 parent 24f59a9 commit 5b56334

File tree

9 files changed

+72
-78
lines changed

9 files changed

+72
-78
lines changed

packages/v2/.vitepress/theme/Layout.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { inBrowser, useData } from 'vitepress'
55
import { watchEffect } from 'vue'
66
import { darkTheme, lightTheme } from 'naive-ui'
77
import { useQuasar } from 'quasar'
8+
import { useI18n } from 'vue-i18n'
89
910
// const isDark = ref(false)
1011
// isDark.value = useColorMode().value === 'dark';
@@ -16,16 +17,27 @@ import { useQuasar } from 'quasar'
1617
const { isDark } = useData()
1718
const { lang } = useData()
1819
const $q = useQuasar()
20+
const { locale } = useI18n({ useScope: 'global' })
1921
2022
watchEffect(() => {
2123
//
22-
// todo x: fix: dark mode change
24+
// todo x: fix for quasar, dark mode change
2325
//
2426
$q.dark.set(isDark.value)
2527
28+
//
29+
// todo x: fix i18n for quasar, need update locale
30+
//
31+
locale.value = lang.value
32+
// console.log('lang: ', lang.value)
33+
console.log('update i18n locale: ', locale.value)
34+
2635
if (inBrowser) {
2736
document.cookie = `nf_lang=${lang.value}; expires=Mon, 1 Jan 2050 00:00:00 UTC; path=/`
2837
}
38+
39+
// change language
40+
document.documentElement.lang = lang.value
2941
})
3042
</script>
3143

packages/v2/.vitepress/theme/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import {
3131
} from 'quasar' // Import icon libraries
3232
import '@quasar/extras/material-icons/material-icons.css' // Import Quasar css
3333
import 'quasar/src/css/index.sass'
34+
import { createI18n } from 'vue-i18n'
35+
import messages from '../../src/i18n'
3436

3537
export default {
3638
extends: DefaultTheme,
@@ -85,5 +87,16 @@ export default {
8587
},
8688
}
8789
)
90+
91+
//
92+
// i18n
93+
//
94+
const i18n = createI18n({
95+
locale: 'en-US',
96+
fallbackLocale: 'en-US',
97+
legacy: false,
98+
messages,
99+
})
100+
app.use(i18n)
88101
},
89102
} satisfies Theme

packages/v2/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- ✅ 集成 [naive-ui](https://www.naiveui.com/), 并修复了`主题(明/暗)`切换
1010
- ✅ 集成 [quasar](https://quasar.dev/), 参考文档: [vite-plugin](https://quasar.dev/start/vite-plugin/)
1111
- 修复了`主题(明/暗)`切换
12+
- 修复 `i18n` 不生效问题, 在 `Layout.vue` 中更新`i18n`设置
1213
- 修复无法`自动导入组件(找不到组件)`, 参见: [.vitepress/theme/index.ts](./.vitepress/theme/index.ts)
1314
- ✅ 集成 [unplugin-vue-components](https://github.com/antfu/unplugin-vue-components)
1415
- ✅ 集成 [unplugin-auto-import](https://github.com/antfu/unplugin-auto-import)

packages/v2/src/boot/.gitkeep

Whitespace-only changes.

packages/v2/src/boot/axios.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

packages/v2/src/boot/i18n.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/v2/src/i18n/index.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
import enUS from './en-US';
2-
import zhCN from './zh-CN';
3-
import ja from './ja';
4-
import de from './de';
1+
import enUS from './en-US'
2+
import zhCN from './zh-CN'
3+
import ja from './ja'
4+
import de from './de'
55

6+
//
7+
// todo x: Layout.vue, fix i18n
8+
//
69
export default {
710
'en-US': enUS,
811
'zh-CN': zhCN,
9-
'ja': ja,
10-
'de': de,
11-
};
12+
'zh-Hans': zhCN,
13+
zh: zhCN,
14+
ja: ja,
15+
de: de,
16+
}

packages/v2/src/pages/ProductPage.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
<q-tab-panel name="desc">
4545
<n-gradient-text type="warning">
4646
<n-ellipsis expand-trigger="click" line-clamp="13">
47+
{{ $t('app.copyright') }} <br />
48+
{{ $t('app.type') }} <br />
49+
4750
电灯熄灭 物换星移 泥牛入海<br />
4851
黑暗好像 一颗巨石 按在胸口<br />
4952
黑暗好像 一颗巨石 按在胸口<br />

packages/v2/src/zh/products/product1.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,39 @@
22
layout: home
33
---
44

5-
6-
7-
8-
95
# Geek Wallet
106

11-
## 简介
7+
## 概览
128

139
- 一个很棒的钱包应用
1410
- 跨平台(mac、windows、linux)
1511
- 支持多链
16-
- 支持多语言
12+
- 支持多语言
13+
14+
<product-page/>
15+
16+
## 下载
17+
18+
<w-download></w-download>
19+
20+
## 价格
21+
22+
<w-pricing></w-pricing>
23+
24+
## 密钥
25+
26+
<w-license></w-license>
27+
28+
## 帮助
29+
30+
<w-help></w-help>
31+
32+
33+
<script setup>
34+
// prettier-ignore
35+
import ProductPage from "../../pages/ProductPage.vue";
36+
import WDownload from "../../components/WDownload.vue";
37+
import WPricing from "../../components/WPricing.vue";
38+
import WLicense from "../../components/WLicense.vue";
39+
import WHelp from "../../components/WHelp.vue";
40+
</script>

0 commit comments

Comments
 (0)