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:
+7
-7
@@ -17,11 +17,11 @@ type MysqlConfig struct {
|
||||
func NewMysql(mysqlConf *MysqlConfig, logwriter logger.Writer) *gorm.DB {
|
||||
db, err := gorm.Open(mysql.New(mysql.Config{
|
||||
DSN: mysqlConf.Dsn, // DSN data source name
|
||||
DefaultStringSize: 256, // string 类型字段的默认长度
|
||||
//DisableDatetimePrecision: true, // 禁用 datetime 精度,MySQL 5.6 之前的数据库不支持
|
||||
//DontSupportRenameIndex: true, // 重命名索引时采用删除并新建的方式,MySQL 5.7 之前的数据库和 MariaDB 不支持重命名索引
|
||||
//DontSupportRenameColumn: true, // 用 `change` 重命名列,MySQL 8 之前的数据库和 MariaDB 不支持重命名列
|
||||
//SkipInitializeWithVersion: false, // 根据当前 MySQL 版本自动配置
|
||||
DefaultStringSize: 256, // default length for string type fields
|
||||
//DisableDatetimePrecision: true, // disable datetime precision; not supported by databases before MySQL 5.6
|
||||
//DontSupportRenameIndex: true, // rename indexes by dropping and recreating them; databases before MySQL 5.7 and MariaDB do not support renaming indexes
|
||||
//DontSupportRenameColumn: true, // rename columns using `change`; databases before MySQL 8 and MariaDB do not support renaming columns
|
||||
//SkipInitializeWithVersion: false, // auto-configure based on the current MySQL version
|
||||
}), &gorm.Config{
|
||||
DisableForeignKeyConstraintWhenMigrating: true,
|
||||
Logger: logger.New(
|
||||
@@ -42,10 +42,10 @@ func NewMysql(mysqlConf *MysqlConfig, logwriter logger.Writer) *gorm.DB {
|
||||
if err2 != nil {
|
||||
fmt.Println(err2)
|
||||
}
|
||||
// SetMaxIdleConns 设置空闲连接池中连接的最大数量
|
||||
// SetMaxIdleConns sets the maximum number of connections in the idle connection pool
|
||||
sqlDB.SetMaxIdleConns(mysqlConf.MaxIdleConns)
|
||||
|
||||
// SetMaxOpenConns 设置打开数据库连接的最大数量。
|
||||
// SetMaxOpenConns sets the maximum number of open database connections.
|
||||
sqlDB.SetMaxOpenConns(mysqlConf.MaxOpenConns)
|
||||
|
||||
return db
|
||||
|
||||
@@ -35,10 +35,10 @@ func NewPostgresql(conf *PostgresqlConfig, logwriter logger.Writer) *gorm.DB {
|
||||
if err2 != nil {
|
||||
fmt.Println(err2)
|
||||
}
|
||||
// SetMaxIdleConns 设置空闲连接池中连接的最大数量
|
||||
// SetMaxIdleConns sets the maximum number of connections in the idle connection pool
|
||||
sqlDB.SetMaxIdleConns(conf.MaxIdleConns)
|
||||
|
||||
// SetMaxOpenConns 设置打开数据库连接的最大数量。
|
||||
// SetMaxOpenConns sets the maximum number of open database connections.
|
||||
sqlDB.SetMaxOpenConns(conf.MaxOpenConns)
|
||||
|
||||
return db
|
||||
|
||||
+2
-2
@@ -34,10 +34,10 @@ func NewSqlite(sqliteConf *SqliteConfig, logwriter logger.Writer) *gorm.DB {
|
||||
if err2 != nil {
|
||||
fmt.Println(err2)
|
||||
}
|
||||
// SetMaxIdleConns 设置空闲连接池中连接的最大数量
|
||||
// SetMaxIdleConns sets the maximum number of connections in the idle connection pool
|
||||
sqlDB.SetMaxIdleConns(sqliteConf.MaxIdleConns)
|
||||
|
||||
// SetMaxOpenConns 设置打开数据库连接的最大数量。
|
||||
// SetMaxOpenConns sets the maximum number of open database connections.
|
||||
sqlDB.SetMaxOpenConns(sqliteConf.MaxOpenConns)
|
||||
|
||||
return db
|
||||
|
||||
Reference in New Issue
Block a user