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:
Vendored
+5
-5
@@ -6,7 +6,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// 此处实现了一个简单的缓存,用于测试
|
||||
// implements a simple cache used for testing
|
||||
// SimpleCache is a simple cache implementation
|
||||
type SimpleCache struct {
|
||||
data map[string]interface{}
|
||||
@@ -19,21 +19,21 @@ func (s *SimpleCache) Get(key string, value interface{}) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
// 使用反射将存储的值设置到传入的指针变量中
|
||||
// use reflection to set the stored value into the passed-in pointer variable
|
||||
val := reflect.ValueOf(value)
|
||||
if val.Kind() != reflect.Ptr {
|
||||
return errors.New("value must be a pointer")
|
||||
}
|
||||
v, ok := s.data[key]
|
||||
if !ok {
|
||||
//设为空值
|
||||
// set to zero value
|
||||
val.Elem().Set(reflect.Zero(val.Elem().Type()))
|
||||
return nil
|
||||
}
|
||||
|
||||
vval := reflect.ValueOf(v)
|
||||
if val.Elem().Type() != vval.Type() {
|
||||
//设为空值
|
||||
// set to zero value
|
||||
val.Elem().Set(reflect.Zero(val.Elem().Type()))
|
||||
return nil
|
||||
}
|
||||
@@ -45,7 +45,7 @@ func (s *SimpleCache) Get(key string, value interface{}) error {
|
||||
func (s *SimpleCache) Set(key string, value interface{}, exp int) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
// 检查传入的值是否是指针,如果是则取其值
|
||||
// check whether the passed-in value is a pointer; if so, dereference it
|
||||
val := reflect.ValueOf(value)
|
||||
if val.Kind() == reflect.Ptr {
|
||||
val = val.Elem()
|
||||
|
||||
Reference in New Issue
Block a user