f81ac5651a
1. Add eslint plugin spellcheck to check word spell 2. Fix word spell Change-Id: I73d39cf797ef5bdf993b0154816134a1e93f2ed4
1.3 KiB
1.3 KiB
English | 简体中文
Usage
Code location
src/locales/index.js
- English:
src/locales/en.json
- Chinese:
src/locales/zh.json
How to use
-
The strings that need to be displayed internationally in the code are all in English, after using cli to complete string collection, generally, there is no need to update
en.json
, only need to modify the corresponding Chinese inzh.json
to complete the internationalization operation -
Use function
t
to translate the string- Take
instance
as an example, Corresponding international writing ist('instance')
- Note that English is case relevant
- Function
T
supports strings with parameters-
Params use
{}
to mark, for example :confirmContext = () => t('Are you sure to { action }?', { action: this.actionName || this.title, });
-
- Take
-
Collect
yarn run i18n
- After collect,
en.json
andzh.json
will automatically update.
- After collect,
-
Update Chinese
- After collect, just update directly in
zh.json
.
- After collect, just update directly in