i18n: Translate all Chinese to English across the codebase
Translate Chinese comments, log/error messages, validator labels and Swagger annotations to English throughout the source code, generated Swagger docs, config files and CI workflows. Make the English README primary: README.md now holds the English docs and README_EN.md holds the Chinese version, with cross-language links updated accordingly. Note: the generated docs/ swagger files were translated in place; run `go generate ./...` (swag init) to regenerate them from the now-English annotations when a Go toolchain is available. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -24,7 +24,7 @@ import (
|
||||
func ApiInitValidator() {
|
||||
validate := validator.New()
|
||||
|
||||
// 定义不同的语言翻译
|
||||
// define translations for different languages
|
||||
enT := en.New()
|
||||
cn := zh_Hans_CN.New()
|
||||
koT := ko.New()
|
||||
@@ -81,7 +81,7 @@ func ApiInitValidator() {
|
||||
return label
|
||||
})
|
||||
Validator.Validate = validate
|
||||
Validator.UT = uni // 存储 Universal Translator
|
||||
Validator.UT = uni // store the Universal Translator
|
||||
Validator.VTrans = zhTrans
|
||||
|
||||
Validator.ValidStruct = func(ctx *gin.Context, i interface{}) []string {
|
||||
|
||||
+2
-2
@@ -10,14 +10,14 @@ import (
|
||||
func InitI18n() {
|
||||
bundle := i18n.NewBundle(language.English)
|
||||
bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
|
||||
//读取global.Config.Gin.ResourcesPath下的所有语言文件
|
||||
// read all language files under global.Config.Gin.ResourcesPath
|
||||
dir := Config.Gin.ResourcesPath + "/i18n"
|
||||
fileInfos, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, fileInfo := range fileInfos {
|
||||
//如果文件名不是.toml结尾
|
||||
// if the file name does not end with .toml
|
||||
if fileInfo.IsDir() || fileInfo.Name()[len(fileInfo.Name())-5:] != ".toml" {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user