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:
@@ -17,7 +17,7 @@ import "github.com/lejianwen/rustdesk-api/v2/model/custom_types"
|
||||
// String loginName; //login username
|
||||
// bool? sameServer;
|
||||
|
||||
// AddressBook 有些字段是Personal才会上传的
|
||||
// AddressBook some fields are only uploaded for Personal
|
||||
type AddressBook struct {
|
||||
RowId uint `gorm:"primaryKey" json:"row_id"`
|
||||
Id string `json:"id" gorm:"default:0;not null;index"`
|
||||
@@ -59,8 +59,8 @@ type AddressBookCollectionRule struct {
|
||||
IdModel
|
||||
UserId uint `json:"user_id" gorm:"default:0;not null;"`
|
||||
CollectionId uint `json:"collection_id" gorm:"default:0;not null;index" validate:"required"`
|
||||
Rule int `json:"rule" gorm:"default:0;not null;" validate:"required,gte=1,lte=3"` // 0: 无 1: 读 2: 读写 3: 完全控制
|
||||
Type int `json:"type" gorm:"default:1;not null;" validate:"required,gte=1,lte=2"` // 1: 个人 2: 群组
|
||||
Rule int `json:"rule" gorm:"default:0;not null;" validate:"required,gte=1,lte=3"` // 0: none 1: read 2: read-write 3: full control
|
||||
Type int `json:"type" gorm:"default:1;not null;" validate:"required,gte=1,lte=2"` // 1: personal 2: group
|
||||
ToId uint `json:"to_id" gorm:"default:0;not null;" validate:"required,gt=0"`
|
||||
TimeModel
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// AutoJson 数据类型
|
||||
// AutoJson data type
|
||||
type AutoJson json.RawMessage
|
||||
|
||||
func (j *AutoJson) Scan(value interface{}) error {
|
||||
@@ -33,7 +33,7 @@ func (j *AutoJson) Scan(value interface{}) error {
|
||||
}
|
||||
result := &json.RawMessage{}
|
||||
err := json.Unmarshal(bytes, result)
|
||||
//解析json错误 返回空
|
||||
// json parse error, return empty
|
||||
if err != nil {
|
||||
*j = AutoJson(json.RawMessage{'[', ']'})
|
||||
return nil
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// AutoTime 自定义时间格式
|
||||
// AutoTime custom time format
|
||||
type AutoTime time.Time
|
||||
|
||||
func (mt AutoTime) Value() (driver.Value, error) {
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package model
|
||||
|
||||
const (
|
||||
GroupTypeDefault = 1 // 默认
|
||||
GroupTypeShare = 2 // 共享
|
||||
GroupTypeDefault = 1 // default
|
||||
GroupTypeShare = 2 // shared
|
||||
)
|
||||
|
||||
type Group struct {
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ import (
|
||||
type StatusCode int
|
||||
|
||||
const (
|
||||
COMMON_STATUS_ENABLE StatusCode = 1 //通用状态 启用
|
||||
COMMON_STATUS_DISABLED StatusCode = 2 //通用状态 禁用
|
||||
COMMON_STATUS_ENABLE StatusCode = 1 // common status: enabled
|
||||
COMMON_STATUS_DISABLED StatusCode = 2 // common status: disabled
|
||||
)
|
||||
|
||||
type IdModel struct {
|
||||
|
||||
+2
-2
@@ -119,7 +119,7 @@ type OidcUser struct {
|
||||
|
||||
func (ou *OidcUser) ToOauthUser() *OauthUser {
|
||||
var username string
|
||||
// 使用 PreferredUsername,如果不存在,降级到 Email 前缀
|
||||
// Use PreferredUsername; if not present, fall back to the Email prefix
|
||||
if ou.PreferredUsername != "" {
|
||||
username = ou.PreferredUsername
|
||||
} else {
|
||||
@@ -169,7 +169,7 @@ func (lu *LinuxdoUser) ToOauthUser() *OauthUser {
|
||||
Name: lu.Name,
|
||||
Username: strings.ToLower(lu.Username),
|
||||
Email: lu.Email,
|
||||
VerifiedEmail: true, // linux.do 用户邮箱默认已验证
|
||||
VerifiedEmail: true, // linux.do user emails are verified by default
|
||||
Picture: lu.Avatar,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ type ShareRecord struct {
|
||||
TimeModel
|
||||
}
|
||||
|
||||
// ShareRecordList 分享记录列表
|
||||
// ShareRecordList share record list
|
||||
type ShareRecordList struct {
|
||||
ShareRecords []*ShareRecord `json:"list,omitempty"`
|
||||
Pagination
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ type Tag struct {
|
||||
IdModel
|
||||
Name string `json:"name" gorm:"default:'';not null;"`
|
||||
UserId uint `json:"user_id" gorm:"default:0;not null;index"`
|
||||
Color uint `json:"color" gorm:"default:0;not null;"` //color 是flutter的颜色值,从0x00000000 到 0xFFFFFFFF; 前两位表示透明度,后面6位表示颜色, 可以转成rgba
|
||||
Color uint `json:"color" gorm:"default:0;not null;"` //color is a flutter color value, from 0x00000000 to 0xFFFFFFFF; the first two digits represent the alpha (transparency), the remaining 6 digits represent the color, can be converted to rgba
|
||||
CollectionId uint `json:"collection_id" gorm:"default:0;not null;index"`
|
||||
Collection *AddressBookCollection `json:"collection,omitempty"`
|
||||
TimeModel
|
||||
|
||||
+2
-2
@@ -15,9 +15,9 @@ type User struct {
|
||||
TimeModel
|
||||
}
|
||||
|
||||
// BeforeSave 钩子用于确保 email 字段有合理的默认值
|
||||
// BeforeSave hook ensures the email field has a sensible default value
|
||||
//func (u *User) BeforeSave(tx *gorm.DB) (err error) {
|
||||
// // 如果 email 为空,设置为默认值
|
||||
// // If email is empty, set it to a default value
|
||||
// if u.Email == "" {
|
||||
// u.Email = fmt.Sprintf("%s@example.com", u.Username)
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user