The Apache APISIX Dashboard uses @umijs/plugin-locale to solve the i18n issues, in order to make the i18n more clear and reasonable, we would recommend to obey the following rules
src/locales
.src/pages/$PAGE/locales
folder.src/components/$COMPONENT/locales
folder, and we MUST import them manuallythe key can be like this : [basicModule].[moduleName].[elementName].[...desc]
what's the first tow levels? e.g: app.pwa
, page.consumer
, component.actionBar
The subkeys are divided into $element + $description style e.g: app.pwa.message.offline
, component.actionBar.button.nextStep
page.consumer.proTableColumns.username
.page.route.form.itemRulesExtraMessage1.path
, page.route.form.itemRulesExtraMessage2.path
.common texts, we should not repeat in other part, and the common locale key omit [elementName] would be better.
page.route.parameterPosition
.global
as the moduleName,git e.g:component.global.confirm
.we have already defined many global keys, before you do i18n, you can refer to those.
element | props | locale subKey |
---|---|---|
Form.Item | label | form.itemLabel |
Form.Item | rules.required | form.itemRulesRequiredMessage |
Form.Item | rules.pattern | form.itemRulesPatternMessage |
Form.Item | extra | form.itemExtraMessage |
Example:
'page.route.form.itemRulesExtraMessage.parameterName': '仅支持字母和数字,且只能以字母开头',
'page.route.form.itemRulesPatternMessage.apiNameRule': '最大长度应小于100',
element | props | locale subKey |
---|---|---|
Input | placeholder | input.placeholder |
Example:
'page.route.input.placeholder.parameterNameHttpHeader': '请求头键名,例如:HOST',
element | props | locale subKey |
---|---|---|
Button | null | button |
Example:
'page.route.button.returnList': '返回路由列表',
element | props | locale subKey |
---|---|---|
Steps.step | title | steps.stepTitle |
Example:
'page.route.steps.stepTitle.defineApiRequest': '设置路由信息',
element | props | locale subKey |
---|---|---|
Select.Option | null | select.option |
Example:
'page.route.select.option.enableHttps': '启用 HTTPS',
element | props | locale subKey |
---|---|---|
Radio | null | radio |
Example:
'page.route.radio.staySame': '保持原样',
element | props | locale subKey |
---|---|---|
ProTable | columns.title | proTable.columnsTitle |
ProTable usually appears in conjunction with forms, and columns title are same with form item label, so we recommend these title keys to be the common key in modules.