跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

region.go

32 行 · 1.4 KB历史下载
1package workbench
2
3import "github.com/sylvinus/agent-vm/internal/cage"
4
5// These are product defaults for common regions, not a claim that a country
6// has one language. Unlisted regions retain the user's applied language.
7var regionLanguage = map[string]string{
8 "US": "en", "GB": "en", "CA": "en", "AU": "en", "NZ": "en", "IE": "en", "SG": "en", "IN": "en", "PH": "en", "ZA": "en",
9 "JP": "ja", "KR": "ko", "CN": "zh", "TW": "zh", "HK": "zh",
10 "DE": "de", "AT": "de", "CH": "de", "FR": "fr", "BE": "nl", "NL": "nl", "SE": "sv", "FI": "fi", "NO": "nb", "DK": "da",
11 "ES": "es", "MX": "es", "AR": "es", "CL": "es", "PT": "pt", "BR": "pt", "IT": "it", "PL": "pl", "CZ": "cs", "RO": "ro", "HU": "hu", "GR": "el",
12 "ID": "id", "MY": "ms", "VN": "vi", "IL": "he", "TR": "tr", "UA": "uk", "RU": "ru", "AE": "ar", "SA": "ar",
13}
14
15func languageSuggestion(country string) (locale, browser string) {
16 if language := regionLanguage[country]; language != "" {
17 return language + "_" + country + ".UTF-8", language + "-" + country
18 }
19 return "", ""
20}
21
22func autoRegionSettings(cfg cage.Config, preferences Preferences, location Location) cage.Config {
23 if preferences.AutoTimezone && location.Timezone != "" {
24 cfg.Timezone = location.Timezone
25 }
26 if preferences.AutoLanguage {
27 if locale, browser := languageSuggestion(location.CountryCode); locale != "" {
28 cfg.Locale, cfg.BrowserLanguage = locale, browser
29 }
30 }
31 return cfg
32}