mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 03:43:39 +00:00
- Add go-i18n library for internationalization - Create i18n package with translation keys and YAML locale files (zh/en) - Implement i18n middleware for language detection from user settings and Accept-Language header - Add Language field to UserSetting DTO - Update API response helpers with i18n support (ApiErrorI18n, ApiSuccessI18n) - Migrate hardcoded messages in token, redemption, and user controllers - Add frontend language preference settings component - Sync language preference across header selector and user settings - Auto-restore user language preference on login
26 lines
1.9 KiB
Go
26 lines
1.9 KiB
Go
package dto
|
|
|
|
type UserSetting struct {
|
|
NotifyType string `json:"notify_type,omitempty"` // QuotaWarningType 额度预警类型
|
|
QuotaWarningThreshold float64 `json:"quota_warning_threshold,omitempty"` // QuotaWarningThreshold 额度预警阈值
|
|
WebhookUrl string `json:"webhook_url,omitempty"` // WebhookUrl webhook地址
|
|
WebhookSecret string `json:"webhook_secret,omitempty"` // WebhookSecret webhook密钥
|
|
NotificationEmail string `json:"notification_email,omitempty"` // NotificationEmail 通知邮箱地址
|
|
BarkUrl string `json:"bark_url,omitempty"` // BarkUrl Bark推送URL
|
|
GotifyUrl string `json:"gotify_url,omitempty"` // GotifyUrl Gotify服务器地址
|
|
GotifyToken string `json:"gotify_token,omitempty"` // GotifyToken Gotify应用令牌
|
|
GotifyPriority int `json:"gotify_priority"` // GotifyPriority Gotify消息优先级
|
|
AcceptUnsetRatioModel bool `json:"accept_unset_model_ratio_model,omitempty"` // AcceptUnsetRatioModel 是否接受未设置价格的模型
|
|
RecordIpLog bool `json:"record_ip_log,omitempty"` // 是否记录请求和错误日志IP
|
|
SidebarModules string `json:"sidebar_modules,omitempty"` // SidebarModules 左侧边栏模块配置
|
|
BillingPreference string `json:"billing_preference,omitempty"` // BillingPreference 扣费策略(订阅/钱包)
|
|
Language string `json:"language,omitempty"` // Language 用户语言偏好 (zh, en)
|
|
}
|
|
|
|
var (
|
|
NotifyTypeEmail = "email" // Email 邮件
|
|
NotifyTypeWebhook = "webhook" // Webhook
|
|
NotifyTypeBark = "bark" // Bark 推送
|
|
NotifyTypeGotify = "gotify" // Gotify 推送
|
|
)
|