refactor: remove LocaleSwitcher component and update locale handling
- Removed LocaleSwitcher from NavUser, SiteHeader, and WorkbenchHeader components. - Updated tests to reflect the removal of LocaleSwitcher. - Changed default locale from "en-US" to "zh-CN" in i18n configuration. - Refactored locale resolution logic to read configured locale without relying on browser language detection. - Updated AgentDesk SDK to support language configuration from public API. - Cleaned up unused auth options fetching in the auth API.
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Language string `yaml:"language"`
|
||||
Server ServerConfig `yaml:"server"`
|
||||
DB DBConfig `yaml:"db"`
|
||||
Logger LoggerConfig `yaml:"logger"`
|
||||
@@ -21,6 +22,17 @@ type Config struct {
|
||||
CustomerSession CustomerSessionConfig `yaml:"customerSession"`
|
||||
}
|
||||
|
||||
func (c Config) LanguageOrDefault() string {
|
||||
switch strings.ToLower(strings.TrimSpace(c.Language)) {
|
||||
case "zh", "zh-cn", "zh_cn", "zh-hans":
|
||||
return "zh-CN"
|
||||
case "en", "en-us", "en_us":
|
||||
return "en-US"
|
||||
default:
|
||||
return "zh-CN"
|
||||
}
|
||||
}
|
||||
|
||||
type WxWorkNotifyConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
ToUsers []int64 `yaml:"toUsers"`
|
||||
|
||||
Reference in New Issue
Block a user