Skip to content

Commit 1ff580d

Browse files
committed
refactor: Update i18n to Composition API mode
1 parent 17e2f2f commit 1ff580d

File tree

4 files changed

+50
-41
lines changed

4 files changed

+50
-41
lines changed

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ Your sponsorship will help us continue to iterate on this exciting project! 🚀
191191
</p>
192192

193193
<p align="center">
194-
<a href="https://github.com/keyFeng"><img src="https://github.com/keyFeng.png" width="60px" alt="keyFeng" /></a>
195-
<a href="https://github.com/ljt990218"><img src="https://github.com/ljt990218.png" width="60px" alt="ljt990218" /></a>
194+
<a href="https://github.com/keyFeng"><img src="https://avatars.githubusercontent.com/u/52267976?v=4" width="60px" alt="keyFeng" /></a>
195+
<a href="https://github.com/ljt990218"><img src="https://avatars.githubusercontent.com/u/50509815?v=4" width="60px" alt="ljt990218" /></a>
196196
</p>
197197

198198
<h2 align="center">
@@ -204,20 +204,24 @@ Our contributors have made this project better. Thank you! 🙏
204204
</p>
205205

206206
<p align="center">
207-
<a href="https://github.com/CharleeWa"><img src="https://github.com/CharleeWa.png" width="60px" alt="CharleeWa" /></a>
208-
<a href="https://github.com/ljt990218"><img src="https://github.com/ljt990218.png" width="60px" alt="ljt990218" /></a>
209-
<a href="https://github.com/wswmsword"><img src="https://github.com/wswmsword.png" width="60px" alt="wswmsword" /></a>
210-
<a href="https://github.com/weiq"><img src="https://github.com/weiq.png" width="60px" alt="weiq" /></a>
211-
<a href="https://github.com/SublimeCT"><img src="https://github.com/SublimeCT.png" width="60px" alt="SublimeCT" /></a>
212-
<a href="https://github.com/ReginYuan"><img src="https://github.com/ReginYuan.png" width="60px" alt="ReginYuan" /></a>
213-
<a href="https://github.com/smartsf"><img src="https://github.com/smartsf.png" width="60px" alt="smartsf" /></a>
214-
<a href="https://github.com/Kysen777"><img src="https://github.com/Kysen777.png" width="60px" alt="Kysen777" /></a>
215-
<a href="https://github.com/Leezon"><img src="https://github.com/Leezon.png" width="60px" alt="Leezon" /></a>
216-
<a href="https://github.com/AlphaYoung111"><img src="https://github.com/AlphaYoung111.png" width="60px" alt="AlphaYoung111" /></a>
217-
<a href="https://github.com/leo4developer"><img src="https://github.com/leo4developer.png" width="60px" alt="leo4developer" /></a>
218-
<a href="https://github.com/InsHomePgup"><img src="https://github.com/InsHomePgup.png" width="60px" alt="InsHomePgup" /></a>
219-
<a href="https://github.com/wowping"><img src="https://github.com/wowping.png" width="60px" alt="wowping" /></a>
220-
<a href="https://github.com/ChunyuPCY"><img src="https://github.com/ChunyuPCY.png" width="60px" alt="ChunyuPCY" /></a>
221-
<a href="https://github.com/qiyue2015"><img src="https://github.com/qiyue2015.png" width="60px" alt="qiyue2015" /></a>
222-
<a href="https://github.com/pyQianYi"><img src="https://github.com/pyQianYi.png" width="60px" alt="pyQianYi" /></a>
207+
<a href="https://github.com/CharleeWa"><img src="https://avatars.githubusercontent.com/u/22477554?v=4" width="60px" alt="CharleeWa" /></a>
208+
<a href="https://github.com/ljt990218"><img src="https://avatars.githubusercontent.com/u/50509815?v=4" width="60px" alt="ljt990218" /></a>
209+
<a href="https://github.com/wswmsword"><img src="https://avatars.githubusercontent.com/u/26893092?v=4" width="60px" alt="wswmsword" /></a>
210+
<a href="https://github.com/weiq"><img src="https://avatars.githubusercontent.com/u/1697158?v=4" width="60px" alt="weiq" /></a>
211+
<a href="https://github.com/SublimeCT"><img src="https://avatars.githubusercontent.com/u/20380890?v=4" width="60px" alt="SublimeCT" /></a>
212+
<a href="https://github.com/ReginYuan"><img src="https://avatars.githubusercontent.com/u/49477488?v=4" width="60px" alt="ReginYuan" /></a>
213+
<a href="https://github.com/smartsf"><img src="https://avatars.githubusercontent.com/u/19995400?v=4" width="60px" alt="smartsf" /></a>
214+
<a href="https://github.com/Kysen777"><img src="https://avatars.githubusercontent.com/u/63892082?v=4" width="60px" alt="Kysen777" /></a>
215+
<a href="https://github.com/Leezon"><img src="https://avatars.githubusercontent.com/u/38120280?v=4" width="60px" alt="Leezon" /></a>
216+
<a href="https://github.com/AlphaYoung111"><img src="https://avatars.githubusercontent.com/u/54132313?v=4" width="60px" alt="AlphaYoung111" /></a>
217+
<a href="https://github.com/leo4developer"><img src="https://avatars.githubusercontent.com/u/15160478?v=4" width="60px" alt="leo4developer" /></a>
218+
<a href="https://github.com/InsHomePgup"><img src="https://avatars.githubusercontent.com/u/47906083?v=4" width="60px" alt="InsHomePgup" /></a>
219+
<a href="https://github.com/wowping"><img src="https://avatars.githubusercontent.com/u/137802961?v=4" width="60px" alt="wowping" /></a>
220+
<a href="https://github.com/ChunyuPCY"><img src="https://avatars.githubusercontent.com/u/21986942?v=4" width="60px" alt="ChunyuPCY" /></a>
221+
<a href="https://github.com/qiyue2015"><img src="https://avatars.githubusercontent.com/u/11554433?v=4" width="60px" alt="qiyue2015" /></a>
222+
<a href="https://github.com/pyQianYi"><img src="https://avatars.githubusercontent.com/u/57526688?v=4" width="60px" alt="pyQianYi" /></a>
223223
</p>
224+
225+
## License
226+
227+
[MIT](./LICENSE) License

README.zh-CN.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ pnpm build
191191
</p>
192192

193193
<p align="center">
194-
<a href="https://github.com/keyFeng"><img src="https://github.com/keyFeng.png" width="60px" alt="keyFeng" /></a>
195-
<a href="https://github.com/ljt990218"><img src="https://github.com/ljt990218.png" width="60px" alt="ljt990218" /></a>
194+
<a href="https://github.com/keyFeng"><img src="https://avatars.githubusercontent.com/u/52267976?v=4" width="60px" alt="keyFeng" /></a>
195+
<a href="https://github.com/ljt990218"><img src="https://avatars.githubusercontent.com/u/50509815?v=4" width="60px" alt="ljt990218" /></a>
196196
</p>
197197

198198
<h2 align="center">
@@ -204,20 +204,24 @@ pnpm build
204204
</p>
205205

206206
<p align="center">
207-
<a href="https://github.com/CharleeWa"><img src="https://github.com/CharleeWa.png" width="60px" alt="CharleeWa" /></a>
208-
<a href="https://github.com/ljt990218"><img src="https://github.com/ljt990218.png" width="60px" alt="ljt990218" /></a>
209-
<a href="https://github.com/wswmsword"><img src="https://github.com/wswmsword.png" width="60px" alt="wswmsword" /></a>
210-
<a href="https://github.com/weiq"><img src="https://github.com/weiq.png" width="60px" alt="weiq" /></a>
211-
<a href="https://github.com/SublimeCT"><img src="https://github.com/SublimeCT.png" width="60px" alt="SublimeCT" /></a>
212-
<a href="https://github.com/ReginYuan"><img src="https://github.com/ReginYuan.png" width="60px" alt="ReginYuan" /></a>
213-
<a href="https://github.com/smartsf"><img src="https://github.com/smartsf.png" width="60px" alt="smartsf" /></a>
214-
<a href="https://github.com/Kysen777"><img src="https://github.com/Kysen777.png" width="60px" alt="Kysen777" /></a>
215-
<a href="https://github.com/Leezon"><img src="https://github.com/Leezon.png" width="60px" alt="Leezon" /></a>
216-
<a href="https://github.com/AlphaYoung111"><img src="https://github.com/AlphaYoung111.png" width="60px" alt="AlphaYoung111" /></a>
217-
<a href="https://github.com/leo4developer"><img src="https://github.com/leo4developer.png" width="60px" alt="leo4developer" /></a>
218-
<a href="https://github.com/InsHomePgup"><img src="https://github.com/InsHomePgup.png" width="60px" alt="InsHomePgup" /></a>
219-
<a href="https://github.com/wowping"><img src="https://github.com/wowping.png" width="60px" alt="wowping" /></a>
220-
<a href="https://github.com/ChunyuPCY"><img src="https://github.com/ChunyuPCY.png" width="60px" alt="ChunyuPCY" /></a>
221-
<a href="https://github.com/qiyue2015"><img src="https://github.com/qiyue2015.png" width="60px" alt="qiyue2015" /></a>
222-
<a href="https://github.com/pyQianYi"><img src="https://github.com/pyQianYi.png" width="60px" alt="pyQianYi" /></a>
207+
<a href="https://github.com/CharleeWa"><img src="https://avatars.githubusercontent.com/u/22477554?v=4" width="60px" alt="CharleeWa" /></a>
208+
<a href="https://github.com/ljt990218"><img src="https://avatars.githubusercontent.com/u/50509815?v=4" width="60px" alt="ljt990218" /></a>
209+
<a href="https://github.com/wswmsword"><img src="https://avatars.githubusercontent.com/u/26893092?v=4" width="60px" alt="wswmsword" /></a>
210+
<a href="https://github.com/weiq"><img src="https://avatars.githubusercontent.com/u/1697158?v=4" width="60px" alt="weiq" /></a>
211+
<a href="https://github.com/SublimeCT"><img src="https://avatars.githubusercontent.com/u/20380890?v=4" width="60px" alt="SublimeCT" /></a>
212+
<a href="https://github.com/ReginYuan"><img src="https://avatars.githubusercontent.com/u/49477488?v=4" width="60px" alt="ReginYuan" /></a>
213+
<a href="https://github.com/smartsf"><img src="https://avatars.githubusercontent.com/u/19995400?v=4" width="60px" alt="smartsf" /></a>
214+
<a href="https://github.com/Kysen777"><img src="https://avatars.githubusercontent.com/u/63892082?v=4" width="60px" alt="Kysen777" /></a>
215+
<a href="https://github.com/Leezon"><img src="https://avatars.githubusercontent.com/u/38120280?v=4" width="60px" alt="Leezon" /></a>
216+
<a href="https://github.com/AlphaYoung111"><img src="https://avatars.githubusercontent.com/u/54132313?v=4" width="60px" alt="AlphaYoung111" /></a>
217+
<a href="https://github.com/leo4developer"><img src="https://avatars.githubusercontent.com/u/15160478?v=4" width="60px" alt="leo4developer" /></a>
218+
<a href="https://github.com/InsHomePgup"><img src="https://avatars.githubusercontent.com/u/47906083?v=4" width="60px" alt="InsHomePgup" /></a>
219+
<a href="https://github.com/wowping"><img src="https://avatars.githubusercontent.com/u/137802961?v=4" width="60px" alt="wowping" /></a>
220+
<a href="https://github.com/ChunyuPCY"><img src="https://avatars.githubusercontent.com/u/21986942?v=4" width="60px" alt="ChunyuPCY" /></a>
221+
<a href="https://github.com/qiyue2015"><img src="https://avatars.githubusercontent.com/u/11554433?v=4" width="60px" alt="qiyue2015" /></a>
222+
<a href="https://github.com/pyQianYi"><img src="https://avatars.githubusercontent.com/u/57526688?v=4" width="60px" alt="pyQianYi" /></a>
223223
</p>
224+
225+
## License
226+
227+
[MIT](./LICENSE) License

src/pages/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ const menuItems = computed(() => ([
5050
<template>
5151
<Container :padding-x="0">
5252
<VanCellGroup inset>
53-
<VanCell center :title="$t('home.darkMode')">
53+
<VanCell center :title="t('home.darkMode')">
5454
<template #right-icon>
5555
<VanSwitch v-model="checked" size="20px" aria-label="on/off Dark Mode" @click="toggle()" />
5656
</template>
5757
</VanCell>
5858

5959
<VanCell
6060
is-link
61-
:title="$t('home.language')"
61+
:title="t('home.language')"
6262
:value="language"
6363
@click="showLanguagePicker = true"
6464
/>

src/utils/i18n.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,18 @@ function getI18nLocale() {
3333

3434
export const i18n = createI18n({
3535
locale: getI18nLocale(),
36+
legacy: false,
3637
messages,
3738
})
3839

3940
/** 当前语言 */
4041
export const locale = computed({
4142
get() {
42-
return (i18n.global.locale as unknown as Ref<string>).value
43+
return i18n.global.locale.value
4344
},
4445
set(language: string) {
45-
localStorage.setItem('language', language);
46-
(i18n.global.locale as unknown as Ref<string>).value = language
46+
localStorage.setItem('language', language)
47+
i18n.global.locale.value = language
4748
Locale.use(language)
4849
},
4950
})

0 commit comments

Comments
 (0)