d5d0e1036b
* docs: add docs * ignore dumi theme test * fix: error TS2717: Subsequent property declarations must have the same type. * update docs * deploy gh-pages * plugins docs * hash & cname * exportStatic * ssr * vercel * vercel * fix: deploy vercel * Delete vercel.json * docs * fix APP_DIST * on master branch
35 lines
569 B
Markdown
35 lines
569 B
Markdown
---
|
||
title: Locales - 国际化
|
||
---
|
||
|
||
# Locales - 国际化 <Badge>未实现</Badge>
|
||
|
||
NocoBase 采用 [formatjs](https://formatjs.io/docs/getting-started/installation) 来处理国际化问题。
|
||
|
||
直接写在代码里,详情参考 formatjs 用例,NocoBase 会封装一个更易用的 `__` 函数来处理国际化,如:
|
||
|
||
```ts
|
||
__('Hello, {name}');
|
||
```
|
||
|
||
在配置里有两种写法:
|
||
|
||
模板字符串:
|
||
|
||
```ts
|
||
{
|
||
name: `{{ __('Hello, {name}') }}`
|
||
}
|
||
```
|
||
|
||
json 格式:
|
||
|
||
```ts
|
||
{
|
||
name: {
|
||
'zh-CN': '{name},您好',
|
||
'en-US': 'Hello, {name}',
|
||
},
|
||
}
|
||
```
|