Internationalization depends on the i18n
extension. If you haven't installed it, you need to execute the ace
command to add internationalization support.
You can configure supported languages in config/admin.ts
.
To quickly create new language files, you can execute the admin:create
command. This command creates corresponding language files in the configuration while creating CRUD pages.
The created language files are as follows:
You can translate languages using the ctx.admin.t
method. This method accepts three parameters: translation content
, translation parameters
, and default value
. If no default value is defined and no translation content is found, the first parameter will be returned as the default value.
Amis comes with two language packs: Chinese and English. If you need to use other languages, you need to configure the language pack in the public/ease/jssdk/locale
folder. And include this language pack when rendering into HTML pages.