Skip to content

Commit f717416

Browse files
docs(i18n): add Chinese (zh-CN) locale example (#7438)
Co-authored-by: Batuhan Wilhelm <batuhanwilhelm@gmail.com>
1 parent f8e4c53 commit f717416

2 files changed

Lines changed: 174 additions & 1 deletion

File tree

documentation/docs/guides-concepts/i18n/index.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ description: "Build i18n in Refine v5. Learn the key steps. Explore translation
88
import I18nHeadless from './i18n-headless.tsx';
99
import TranslationFileEN from '../../partials/\_partial-translation-file-en.md';
1010
import TranslationFileDE from '../../partials/\_partial-translation-file-de.md';
11+
import TranslationFileZH from '../../partials\_partial-translation-file-zh.md';
1112

1213
Internationalization (i18n) is a process that allows software applications to be localized for different regions and languages. Refine can work with any i18n framework, but needs an [`i18nProvider`](/core/docs/i18n/i18n-provider/) to be created based on the chosen library.
1314

@@ -187,7 +188,17 @@ Now, let's add the language files:
187188

188189
<Tabs
189190
defaultValue="en"
190-
values={[{ label: "English", value: "en" }, { label: "German", value: "de" }]}>
191+
values=[{ label: "English", value: "en" }, { label: "German", value: "de" }, { label: "Chinese", value: "zh" }]>
192+
<TabItem value="zh">
193+
194+
<details>
195+
<summary>Show translation file</summary>
196+
197+
<TranslationFileZH />
198+
199+
</details>
200+
201+
</TabItem>
191202
<TabItem value="en">
192203

193204
<details>
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
```json title="/locales/zh-CN/common.json"
2+
{
3+
"pages": {
4+
"login": {
5+
"title": "登录您的账户",
6+
"signin": "登录",
7+
"signup": "注册",
8+
"divider": "",
9+
"fields": {
10+
"email": "电子邮件",
11+
"password": "密码"
12+
},
13+
"errors": {
14+
"validEmail": "无效的电子邮件地址",
15+
"requiredEmail": "电子邮件为必填项",
16+
"requiredPassword": "密码为必填项"
17+
},
18+
"buttons": {
19+
"submit": "登录",
20+
"forgotPassword": "忘记密码?",
21+
"noAccount": "没有账户?",
22+
"rememberMe": "记住我"
23+
}
24+
},
25+
"forgotPassword": {
26+
"title": "忘记密码?",
27+
"fields": {
28+
"email": "电子邮件"
29+
},
30+
"errors": {
31+
"validEmail": "无效的电子邮件地址",
32+
"requiredEmail": "电子邮件为必填项"
33+
},
34+
"buttons": {
35+
"submit": "发送重置说明"
36+
}
37+
},
38+
"register": {
39+
"title": "注册您的账户",
40+
"fields": {
41+
"email": "电子邮件",
42+
"password": "密码"
43+
},
44+
"errors": {
45+
"validEmail": "无效的电子邮件地址",
46+
"requiredEmail": "电子邮件为必填项",
47+
"requiredPassword": "密码为必填项"
48+
},
49+
"buttons": {
50+
"submit": "注册",
51+
"haveAccount": "已有账户?"
52+
}
53+
},
54+
"updatePassword": {
55+
"title": "更新密码",
56+
"fields": {
57+
"password": "新密码",
58+
"confirmPassword": "确认新密码"
59+
},
60+
"errors": {
61+
"confirmPasswordNotMatch": "密码不匹配",
62+
"requiredPassword": "密码为必填项",
63+
"requiredConfirmPassword": "确认密码为必填项"
64+
},
65+
"buttons": {
66+
"submit": "更新"
67+
}
68+
},
69+
"error": {
70+
"info": "您可能忘记将 {{action}} 组件添加到 {{resource}} 资源中。",
71+
"404": "抱歉,您访问的页面不存在。",
72+
"resource404": "您确定已创建 {{resource}} 资源吗?",
73+
"backHome": "返回首页"
74+
}
75+
},
76+
"actions": {
77+
"list": "列表",
78+
"create": "创建",
79+
"edit": "编辑",
80+
"show": "查看"
81+
},
82+
"buttons": {
83+
"create": "创建",
84+
"save": "保存",
85+
"logout": "退出",
86+
"delete": "删除",
87+
"edit": "编辑",
88+
"cancel": "取消",
89+
"confirm": "您确定吗?",
90+
"filter": "筛选",
91+
"clear": "清除",
92+
"refresh": "刷新",
93+
"show": "查看",
94+
"undo": "撤销",
95+
"import": "导入",
96+
"clone": "克隆",
97+
"notAccessTitle": "您没有权限访问"
98+
},
99+
"warnWhenUnsavedChanges": "您确定要离开吗?您有未保存的更改。",
100+
"notifications": {
101+
"success": "成功",
102+
"error": "错误(状态码:{{statusCode}})",
103+
"undoable": "您有 {{seconds}} 秒的时间撤销",
104+
"createSuccess": "成功创建 {{resource}}",
105+
"createError": "创建 {{resource}} 时出错(状态码:{{statusCode}})",
106+
"deleteSuccess": "成功删除 {{resource}}",
107+
"deleteError": "删除 {{resource}} 时出错(状态码:{{statusCode}})",
108+
"editSuccess": "成功编辑 {{resource}}",
109+
"editError": "编辑 {{resource}} 时出错(状态码:{{statusCode}})",
110+
"importProgress": "导入中:{{processed}}/{{total}}"
111+
},
112+
"loading": "加载中",
113+
"tags": {
114+
"clone": "克隆"
115+
},
116+
"dashboard": {
117+
"title": "仪表盘"
118+
},
119+
"posts": {
120+
"posts": "文章",
121+
"fields": {
122+
"id": "编号",
123+
"title": "标题",
124+
"category": "分类",
125+
"status": {
126+
"title": "状态",
127+
"published": "已发布",
128+
"draft": "草稿",
129+
"rejected": "已拒绝"
130+
},
131+
"content": "内容",
132+
"createdAt": "创建时间"
133+
},
134+
"titles": {
135+
"create": "创建文章",
136+
"edit": "编辑文章",
137+
"list": "文章列表",
138+
"show": "查看文章"
139+
}
140+
},
141+
"table": {
142+
"actions": "操作"
143+
},
144+
"documentTitle": {
145+
"default": "refine",
146+
"suffix": " | Refine",
147+
"post": {
148+
"list": "文章 | Refine",
149+
"show": "#{{id}} 查看文章 | Refine",
150+
"edit": "#{{id}} 编辑文章 | Refine",
151+
"create": "创建新文章 | Refine",
152+
"clone": "#{{id}} 克隆文章 | Refine"
153+
}
154+
},
155+
"autoSave": {
156+
"success": "已保存",
157+
"error": "自动保存失败",
158+
"loading": "保存中...",
159+
"idle": "等待更改"
160+
}
161+
}
162+
```

0 commit comments

Comments
 (0)