I18n Translation Text
April 7, 2023Less than 1 minute
I18n Text Generation
goctls extra i18n
goctls extra i18n --model_name=StudentInfo --model_name_zh=学生信息 --target=api --output=D:\projects\simple-workspace\simple-admin-core\api\internal\i18n\locale
Parameter | Required | Default | Description |
---|---|---|---|
model_name | Yes | The name of the model, which is the internal struct name in the schema, such as "StudentInfo" in the example. | |
model_name_zh | Yes | The Chinese translation of the model. | |
target | Yes | Currently only supports "api", which means generating internationalization text for API interfaces. | |
output | No | If empty, the output will be printed to the console for copying, or set it to the location of the "locale" folder, and it will be automatically added to the corresponding location. |
Run
goctls extra i18n -h
see more details
Provide i18 json text generation
Usage:
goctl extra i18n [flags]
Flags:
-h, --help help for i18n
-m, --model_name string The model name, it should be camelcase, such as StudentInfo
-z, --model_name_zh string The model name's Chinese translation, such as 学生信息
-o, --output string The output dir, such as ./i18n/locale
-t, --target string The target type, now only support api
Console generation preview
$ goctls extra i18n --model_name=StudentInfo --model_name_zh=学生信息 --target=api
"createStudentInfo": "创建学生信息",
"updateStudentInfo": "更新学生信息",
"deleteStudentInfo": "删除学生信息",
"getStudentInfoList": "获取学生信息列表",
"getStudentInfoById": "通过ID获取学生信息",
"createStudentInfo": "Create a student info",
"updateStudentInfo": "Update the student info",
"deleteStudentInfo": "Delete student infos",
"getStudentInfoList": "Get student info list",
"getStudentInfoById": "Get student info by ID",