Merge branch 'fork/maoxuner/fix/lang-doc'
This commit is contained in:
@@ -60,25 +60,23 @@ updateLocale('en-US');
|
||||
|
||||
**src/locales/langs/zh-CN/\*.json**
|
||||
|
||||
````ts
|
||||
```json
|
||||
{
|
||||
"about": {
|
||||
"desc": "Vben Admin 是一个现代的管理模版。"
|
||||
}
|
||||
}
|
||||
````
|
||||
```
|
||||
|
||||
**src/locales/langs/en-US.ts**
|
||||
**src/locales/langs/en-US/\*.json**
|
||||
|
||||
````ts
|
||||
```json
|
||||
{
|
||||
"about": {
|
||||
"desc": "Vben Admin is a modern management template."
|
||||
}
|
||||
}
|
||||
````
|
||||
```
|
||||
|
||||
## 使用翻译文本
|
||||
|
||||
@@ -91,11 +89,11 @@ updateLocale('en-US');
|
||||
import { computed } from 'vue';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
const items = computed(() => [{ title: $t('about.desc') }]);
|
||||
const items = computed(() => [{ title: $t('demos.title') }]);
|
||||
</script>
|
||||
<template>
|
||||
<div>{{ $t('about.desc') }}</div>
|
||||
<template v-for="item in items.value">
|
||||
<div>{{ $t('demos.title') }}</div>
|
||||
<template v-for="item in items">
|
||||
<div>{{ item.title }}</div>
|
||||
</template>
|
||||
</template>
|
||||
@@ -105,8 +103,8 @@ const items = computed(() => [{ title: $t('about.desc') }]);
|
||||
|
||||
如果你需要新增语言包,需要按照以下步骤进行:
|
||||
|
||||
- 在 `packages/locales/langs` 目录下新增对应的语言包文件,例:`zh-TW.json`,并翻译对应的文本。
|
||||
- 在对应的应用内,找到 `src/locales/langs` 文件,新增对应的语言包 `zh-TW.json`
|
||||
- 在 `packages/locales/langs` 目录下新增对应的语言包文件夹和文件,例:`zh-TW/*.json`,并翻译对应的文本。
|
||||
- 在对应的应用内,找到 `src/locales/langs` 目录,新增对应的语言包文件夹和文件 `zh-TW/*.json`。
|
||||
- 在 `packages/constants/src/core.ts`内,新增对应的语言:
|
||||
|
||||
```ts
|
||||
|
||||
Reference in New Issue
Block a user