feat(i18n): add English and Simplified Chinese
This commit is contained in:
1 parent
38c4c8b781
commit
1e9e0678ee
149 files changed
+5356
-1144
No files matched your search
@@ -4,9 +4,8 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"rawmark/internal/i18n"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -28,7 +27,7 @@ func (s *Store) Preferences() (map[string]json.RawMessage, error) {
|
||||
return nil, err
|
||||
}
|
||||
if !json.Valid([]byte(value)) {
|
||||
return nil, fmt.Errorf("设置 %s 格式无效", key)
|
||||
return nil, i18n.New("invalid_format_for_setting_s_745c8c", key)
|
||||
}
|
||||
result[key] = json.RawMessage(value)
|
||||
}
|
||||
@@ -47,7 +46,7 @@ func (s *Store) ReplacePreferences(values map[string]json.RawMessage) error {
|
||||
}
|
||||
for key, value := range values {
|
||||
if (key != "app.settings" && key != "plugins.enabled" && !strings.HasPrefix(key, "plugin.data.")) || !json.Valid(value) {
|
||||
return fmt.Errorf("设置包含无效设置项")
|
||||
return i18n.New("settings_contain_an_invalid_entry_90c647")
|
||||
}
|
||||
if _, err = tx.Exec(`INSERT INTO settings(key,value) VALUES (?,?)`, key, string(value)); err != nil {
|
||||
return err
|
||||
@@ -68,7 +67,7 @@ func (s *Store) CheckBackup() error {
|
||||
return err
|
||||
}
|
||||
if result != "ok" {
|
||||
return errors.New("备份数据库完整性检查失败")
|
||||
return i18n.New("backup_database_integrity_check_failed_5adb6a")
|
||||
}
|
||||
for _, query := range []string{`SELECT key,value FROM settings LIMIT 0`, `SELECT token_hash,created_at,expires_at FROM sessions LIMIT 0`, `SELECT id,name,token_hash,scope,created_at,last_used_at FROM api_tokens LIMIT 0`} {
|
||||
rows, err := s.db.Query(query)
|
||||
|
||||
Reference in new issue
Block a user