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:
2026-06-27 12:17:04 +02:00
co-authored by Claude Opus 4.8
parent c5687e1506
commit 16e97c8efa
103 changed files with 3088 additions and 3086 deletions
+23 -23
View File
@@ -12,15 +12,15 @@ import (
type AddressBook struct{}
// List 列表
// @Tags 我的地址簿
// @Summary 地址簿列表
// @Description 地址簿列表
// List list
// @Tags my address book
// @Summary address book list
// @Description address book list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param user_id query int false "用户id"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param user_id query int false "userid"
// @Success 200 {object} response.Response{data=model.AddressBookList}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book/list [get]
@@ -34,7 +34,7 @@ func (ct *AddressBook) List(c *gin.Context) {
u := service.AllService.UserService.CurUser(c)
query.UserId = int(u.Id)
res := service.AllService.AddressBookService.List(query.Page, query.PageSize, func(tx *gorm.DB) {
//预加载地址簿名称
//preload address book name
tx.Preload("Collection", func(txc *gorm.DB) *gorm.DB {
return txc.Select("id,name")
})
@@ -60,13 +60,13 @@ func (ct *AddressBook) List(c *gin.Context) {
response.Success(c, res)
}
// Create 创建地址簿
// @Tags 我的地址簿
// @Summary 创建地址簿
// @Description 创建地址簿
// Create create address book
// @Tags my address book
// @Summary create address book
// @Description create address book
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response{data=model.AddressBook}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book/create [post]
@@ -104,13 +104,13 @@ func (ct *AddressBook) Create(c *gin.Context) {
response.Success(c, nil)
}
// Update 编辑
// @Tags 我的地址簿
// @Summary 地址簿编辑
// @Description 地址簿编辑
// Update edit
// @Tags my address book
// @Summary edit address book
// @Description edit address book
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response{data=model.AddressBook}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book/update [post]
@@ -158,13 +158,13 @@ func (ct *AddressBook) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 我的地址簿
// @Summary 地址簿删除
// @Description 地址簿删除
// Delete delete
// @Tags my address book
// @Summary delete address book
// @Description delete address book
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book/delete [post]
@@ -13,13 +13,13 @@ import (
type AddressBookCollection struct {
}
// Create 创建地址簿名称
// @Tags 我的地址簿名称
// @Summary 创建地址簿名称
// @Description 创建地址簿名称
// Create create address book name
// @Tags my address book name
// @Summary create address book name
// @Description create address book name
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollection true "地址簿名称信息"
// @Param body body model.AddressBookCollection true "address book name info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection/create [post]
@@ -45,14 +45,14 @@ func (abc *AddressBookCollection) Create(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// @Tags 我的地址簿名称
// @Summary 地址簿名称列表
// @Description 地址簿名称列表
// List list
// @Tags my address book name
// @Summary address book name list
// @Description address book name list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Success 200 {object} response.Response{data=model.AddressBookCollectionList}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection/list [get]
@@ -71,13 +71,13 @@ func (abc *AddressBookCollection) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// @Tags 我的地址簿名称
// @Summary 地址簿名称编辑
// @Description 地址簿名称编辑
// Update edit
// @Tags my address book name
// @Summary edit address book name
// @Description edit address book name
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollection true "地址簿名称信息"
// @Param body body model.AddressBookCollection true "address book name info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection/update [post]
@@ -120,13 +120,13 @@ func (abc *AddressBookCollection) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 我的地址簿名称
// @Summary 地址簿名称删除
// @Description 地址簿名称删除
// Delete delete
// @Tags my address book name
// @Summary delete address book name
// @Description delete address book name
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollection true "地址簿名称信息"
// @Param body body model.AddressBookCollection true "address book name info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection/delete [post]
@@ -13,17 +13,17 @@ import (
type AddressBookCollectionRule struct {
}
// List 列表
// @Tags 我的地址簿规则
// @Summary 地址簿规则列表
// @Description 地址簿规则列表
// List list
// @Tags my address book rules
// @Summary address book rule list
// @Description address book rule list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param is_my query int false "是否是我的"
// @Param user_id query int false "用户id"
// @Param collection_id query int false "地址簿集合id"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param is_my query int false "whether it is mine"
// @Param user_id query int false "userid"
// @Param collection_id query int false "address book collectionid"
// @Success 200 {object} response.Response{data=model.AddressBookCollectionList}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection_rule/list [get]
@@ -46,13 +46,13 @@ func (abcr *AddressBookCollectionRule) List(c *gin.Context) {
response.Success(c, res)
}
// Create 创建地址簿规则
// @Tags 我的地址簿规则
// @Summary 创建地址簿规则
// @Description 创建地址簿规则
// Create create address book rule
// @Tags my address book rules
// @Summary create address book rule
// @Description create address book rule
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollectionRule true "地址簿规则信息"
// @Param body body model.AddressBookCollectionRule true "address book rule info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection_rule/create [post]
@@ -106,12 +106,12 @@ func (abcr *AddressBookCollectionRule) CheckForm(u *model.User, t *model.Address
if tou.Id == 0 {
return "ItemNotFound", false
}
//非管理员不能分享给非本组织用户
//non-admins cannot share with users outside their own organization
//if tou.GroupId != u.GroupId {
// return "NoAccess", false
//}
} else if t.Type == model.ShareAddressBookRuleTypeGroup {
//非管理员不能分享给其他组
//non-admins cannot share with other groups
//if t.ToId != u.GroupId {
// return "NoAccess", false
//}
@@ -123,7 +123,7 @@ func (abcr *AddressBookCollectionRule) CheckForm(u *model.User, t *model.Address
} else {
return "ParamsError", false
}
// 重复检查
// duplicate check
ex := service.AllService.AddressBookService.RuleInfoByToIdAndCid(t.Type, t.ToId, t.CollectionId)
if t.Id == 0 && ex.Id > 0 {
return "ItemExists", false
@@ -134,13 +134,13 @@ func (abcr *AddressBookCollectionRule) CheckForm(u *model.User, t *model.Address
return "", true
}
// Update 编辑
// @Tags 我的地址簿规则
// @Summary 地址簿规则编辑
// @Description 地址簿规则编辑
// Update edit
// @Tags my address book rules
// @Summary edit address book rule
// @Description edit address book rule
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollectionRule true "地址簿规则信息"
// @Param body body model.AddressBookCollectionRule true "address book rule info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection_rule/update [post]
@@ -185,13 +185,13 @@ func (abcr *AddressBookCollectionRule) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 我的地址簿规则
// @Summary 地址簿规则删除
// @Description 地址簿规则删除
// Delete delete
// @Tags my address book rules
// @Summary delete address book rule
// @Description delete address book rule
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollectionRule true "地址簿规则信息"
// @Param body body model.AddressBookCollectionRule true "address book rule info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection_rule/delete [post]
+17 -17
View File
@@ -13,15 +13,15 @@ import (
type LoginLog struct {
}
// List 列表
// @Tags 我的登录日志
// @Summary 登录日志列表
// @Description 登录日志列表
// List list
// @Tags my login logs
// @Summary login log list
// @Description login log list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param user_id query int false "用户ID"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param user_id query int false "userID"
// @Success 200 {object} response.Response{data=model.LoginLogList}
// @Failure 500 {object} response.Response
// @Router /admin/my/login_log/list [get]
@@ -40,13 +40,13 @@ func (ct *LoginLog) List(c *gin.Context) {
response.Success(c, res)
}
// Delete 删除
// @Tags 我的登录日志
// @Summary 登录日志删除
// @Description 登录日志删除
// Delete delete
// @Tags my login logs
// @Summary delete login log
// @Description delete login log
// @Accept json
// @Produce json
// @Param body body model.LoginLog true "登录日志信息"
// @Param body body model.LoginLog true "login log info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/login_log/delete [post]
@@ -81,13 +81,13 @@ func (ct *LoginLog) Delete(c *gin.Context) {
response.Fail(c, 101, err.Error())
}
// BatchDelete 删除
// @Tags 我的登录日志
// @Summary 登录日志批量删除
// @Description 登录日志批量删除
// BatchDelete delete
// @Tags my login logs
// @Summary batch delete login logs
// @Description batch delete login logs
// @Accept json
// @Produce json
// @Param body body admin.LoginLogIds true "登录日志"
// @Param body body admin.LoginLogIds true "login log"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/login_log/batchDelete [post]
+9 -9
View File
@@ -12,18 +12,18 @@ import (
type Peer struct {
}
// List 列表
// @Tags 我的设备
// @Summary 设备列表
// @Description 设备列表
// List list
// @Tags my devices
// @Summary device list
// @Description device list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param time_ago query int false "时间"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param time_ago query int false "time"
// @Param id query string false "ID"
// @Param hostname query string false "主机名"
// @Param uuids query string false "uuids 用逗号分隔"
// @Param hostname query string false "hostname"
// @Param uuids query string false "uuids separated by commas"
// @Success 200 {object} response.Response{data=model.PeerList}
// @Failure 500 {object} response.Response
// @Router /admin/my/peer/list [get]
+15 -15
View File
@@ -12,14 +12,14 @@ import (
type ShareRecord struct {
}
// List 分享记录列表
// @Tags 我的分享记录
// @Summary 分享记录列表
// @Description 分享记录列表
// List share record list
// @Tags my share records
// @Summary share record list
// @Description share record list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/share_record/list [get]
@@ -37,13 +37,13 @@ func (sr *ShareRecord) List(c *gin.Context) {
response.Success(c, res)
}
// Delete 分享记录删除
// @Tags 我的分享记录
// @Summary 分享记录删除
// @Description 分享记录删除
// Delete delete share record
// @Tags my share records
// @Summary delete share record
// @Description delete share record
// @Accept json
// @Produce json
// @Param body body admin.ShareRecordForm true "分享记录信息"
// @Param body body admin.ShareRecordForm true "share record info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/share_record/delete [post]
@@ -78,10 +78,10 @@ func (sr *ShareRecord) Delete(c *gin.Context) {
response.Fail(c, 101, response.TranslateMsg(c, "OperationFailed")+err.Error())
}
// BatchDelete 批量删除我的分享记录
// @Tags 我的
// @Summary 批量删除我的分享记录
// @Description 批量删除我的分享记录
// BatchDelete batch delete my share records
// @Tags my
// @Summary batch delete my share records
// @Description batch delete my share records
// @Accept json
// @Produce json
// @Param body body admin.PeerShareRecordBatchDeleteForm true "id"
+23 -23
View File
@@ -11,16 +11,16 @@ import (
type Tag struct{}
// List 列表
// @Tags 我的标签
// @Summary 标签列表
// @Description 标签列表
// List list
// @Tags my tags
// @Summary tag list
// @Description tag list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param is_my query int false "是否是我的"
// @Param user_id query int false "用户id"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param is_my query int false "whether it is mine"
// @Param user_id query int false "userid"
// @Success 200 {object} response.Response{data=model.TagList}
// @Failure 500 {object} response.Response
// @Router /admin/my/tag/list [get]
@@ -45,13 +45,13 @@ func (ct *Tag) List(c *gin.Context) {
response.Success(c, res)
}
// Create 创建标签
// @Tags 我的标签
// @Summary 创建标签
// @Description 创建标签
// Create create tag
// @Tags my tags
// @Summary create tag
// @Description create tag
// @Accept json
// @Produce json
// @Param body body admin.TagForm true "标签信息"
// @Param body body admin.TagForm true "tag info"
// @Success 200 {object} response.Response{data=model.Tag}
// @Failure 500 {object} response.Response
// @Router /admin/my/tag/create [post]
@@ -78,13 +78,13 @@ func (ct *Tag) Create(c *gin.Context) {
response.Success(c, nil)
}
// Update 编辑
// @Tags 我的标签
// @Summary 标签编辑
// @Description 标签编辑
// Update edit
// @Tags my tags
// @Summary edit tag
// @Description edit tag
// @Accept json
// @Produce json
// @Param body body admin.TagForm true "标签信息"
// @Param body body admin.TagForm true "tag info"
// @Success 200 {object} response.Response{data=model.Tag}
// @Failure 500 {object} response.Response
// @Router /admin/my/tag/update [post]
@@ -133,13 +133,13 @@ func (ct *Tag) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 标签
// @Summary 标签删除
// @Description 标签删除
// Delete delete
// @Tags tag
// @Summary delete tag
// @Description delete tag
// @Accept json
// @Produce json
// @Param body body admin.TagForm true "标签信息"
// @Param body body admin.TagForm true "tag info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/tag/delete [post]