Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

feat(profile): 默认档案的「删除」改为「重置」(清空数据但保留会话)

hairyf373280be8a39
diff --git a/src-tauri/src/bridge/profile.rs b/src-tauri/src/bridge/profile.rs
index 94f884cf..0920627b 100644
--- a/src-tauri/src/bridge/profile.rs
+++ b/src-tauri/src/bridge/profile.rs
@@ -1,7 +1,8 @@
//! 多 Profile 环境隔离。
//!
//! 管理 `$DSH_HOME/profiles` 下的档案:列表、创建(web 模板)、切换当前使用中的
-//! 档案,以及删除(默认档案与使用中的档案不可删除)。
+//! 档案,以及删除(默认档案与使用中的档案不可删除)与重置(清空档案数据、
+//! 保留会话)。
use crate::config;
use crate::service::profile;
@@ -31,6 +32,12 @@ pub fn remove_profile(app_handle: AppHandle, id: String) -> Result<(), String> {
profile::remove(&app_handle, &id)
}
+/// 重置档案(清空档案目录并按模板重新初始化;会话数据在档案目录之外,保留)
+#[tauri::command]
+pub fn reset_profile(app_handle: AppHandle, id: String) -> Result<(), String> {
+ profile::reset(&app_handle, &id)
+}
+
/// 克隆档案(全量复制源档案目录,自动递增命名或指定名称)。
///
/// 异步命令:把 CPU/IO 密集的目录树复制放到 `spawn_blocking` 线程池,
diff --git a/src-tauri/src/desktop/builder.rs b/src-tauri/src/desktop/builder.rs
index 1e05d9aa..ba54ed93 100644
--- a/src-tauri/src/desktop/builder.rs
+++ b/src-tauri/src/desktop/builder.rs
@@ -933,6 +933,7 @@ pub fn handler() -> impl Fn(Invoke<Wry>) -> bool + Send + Sync + 'static {
crate::bridge::create_profile,
crate::bridge::set_active_profile,
crate::bridge::remove_profile,
+ crate::bridge::reset_profile,
crate::bridge::clone_profile,
crate::bridge::backup_profile,
crate::bridge::restore_profile,
diff --git a/src-tauri/src/service/profile/mod.rs b/src-tauri/src/service/profile/mod.rs
index 72ae4a27..ab504e0c 100644
--- a/src-tauri/src/service/profile/mod.rs
+++ b/src-tauri/src/service/profile/mod.rs
@@ -549,6 +549,26 @@ pub fn remove(app_handle: &AppHandle, id: &str) -> Result<(), String> {
fs::remove_dir_all(&dir).map_err(|e| format!("PROFILE_REMOVE_FAILED: {e}"))
}
+/// 重置档案:清空档案目录后按官方模板重新初始化。
+///
+/// 只重建 `$DSH_HOME/profiles/<id>`:会话数据存放在 `$DSH_HOME/sessions`(档案
+/// 目录之外),因此重置不影响任何会话。档案内的插件、补丁与设置随目录一并清除,
+/// 随后由 [`init_profile_dir`] 写回 web 模板清单 —— 即回到「刚新建」的状态。
+pub fn reset(app_handle: &AppHandle, id: &str) -> Result<(), String> {
+ let profiles_root = config::get_dsh_data_path(app_handle).join("profiles");
+ reset_with_root(&profiles_root, id)
+}
+
+/// [`reset`] 的根目录显式版本(便于单测注入临时目录,与 [`clone_with_root`] 同形)。
+pub fn reset_with_root(profiles_root: &Path, id: &str) -> Result<(), String> {
+ // 目录缺失(全新安装/被外部清理)时无需删除,直接按模板初始化出干净档案。
+ if fs_guard::join_safe(profiles_root, id)?.is_dir() {
+ let dir = fs_guard::safe_remove_target(profiles_root, id)?;
+ fs::remove_dir_all(&dir).map_err(|e| format!("PROFILE_RESET_FAILED: {e}"))?;
+ }
+ init_profile_dir(&profiles_root.join(id), id)
+}
+
/// 克隆档案:全量复制源档案目录,自动递增命名(web → web-1 → web-2)。
///
/// 以 `profiles_root` 为根,便于单测注入临时目录;调用方(`bridge::clone_profile`)
@@ -1582,6 +1602,54 @@ mod tests {
let _ = std::fs::remove_dir_all(&tmp);
}
+ #[test]
+ fn reset_wipes_profile_data_but_keeps_sessions() {
+ let tmp = std::env::temp_dir().join(format!("dsh-profile-reset-{}", std::process::id()));
+ let _ = std::fs::remove_dir_all(&tmp);
+ let profiles_root = tmp.join("profiles");
+ let sessions = tmp.join("sessions");
+
+ // 档案:模板初始化后再塞入用户数据(插件依赖、补丁层、桌面禁用清单)
+ init_profile_dir(&profiles_root.join("web"), "web").unwrap();
+ std::fs::write(
+ profiles_root.join("web").join("package.json"),
+ r#"{"name":"dsh-profile-web","dependencies":{"some-plugin":"1.2.3"}}"#,
+ )
+ .unwrap();
+ std::fs::write(profiles_root.join("web").join("cordis.patch.yml"), "[]\n").unwrap();
+ std::fs::write(
+ profiles_root.join("web").join("disabled-plugins.json"),
+ r#"["some-plugin"]"#,
+ )
+ .unwrap();
+ // 会话位于档案目录之外,重置不得触碰
+ std::fs::create_dir_all(sessions.join("_no-cwd")).unwrap();
+ std::fs::write(sessions.join("_no-cwd").join("s1.json"), "{}").unwrap();
+
+ reset_with_root(&profiles_root, "web").unwrap();
+
+ // 用户数据被清空,清单回到模板形态(dependencies 为空)
+ let manifest: serde_json::Value = serde_json::from_str(
+ &std::fs::read_to_string(profiles_root.join("web").join("package.json")).unwrap(),
+ )
+ .unwrap();
+ assert_eq!(manifest["name"], "dsh-profile-web");
+ assert_eq!(manifest["dependencies"], serde_json::json!({}));
+ assert_eq!(
+ manifest["dsh"]["profile"]["bundles"],
+ serde_json::json!(["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app"])
+ );
+ assert!(!profiles_root.join("web").join("disabled-plugins.json").exists());
+ // 会话数据完整保留
+ assert!(sessions.join("_no-cwd").join("s1.json").is_file());
+
+ // 目录不存在时也能初始化出干净档案(全新安装/被外部清理)
+ reset_with_root(&profiles_root, "fresh").unwrap();
+ assert!(profiles_root.join("fresh").join("package.json").is_file());
+
+ let _ = std::fs::remove_dir_all(&tmp);
+ }
+
/// 路径穿越回归:`..`、`.`、绝对路径、含分隔符的 id 一律在 remove 前被拦截,
/// 绝不进入 `remove_dir_all`(防 `remove_profile("..")` 删到 $DSH_HOME 本级)。
#[test]
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index ba836d10..b3b9bd5b 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -185,6 +185,14 @@
"profiles.remove_confirm_desc": "Delete {{name}} permanently? Its plugins and settings will be removed. This cannot be undone.",
"profiles.remove_confirm": "Delete",
"profiles.remove_failed": "Failed to delete profile",
+ "profiles.reset": "Reset",
+ "profiles.reset_confirm_title": "Reset profile",
+ "profiles.reset_confirm_desc": "Reset {{name}}? Its plugins, patches, and settings will be cleared and returned to their initial state. Sessions are not affected. This cannot be undone.",
+ "profiles.reset_confirm": "Reset",
+ "profiles.reset_stopped_toast": "Service stopped — resetting…",
+ "profiles.reset_success": "Profile \"{{name}}\" reset",
+ "profiles.reset_success_hint": "Initial plugins and settings restored",
+ "profiles.reset_failed": "Failed to reset profile",
"profiles.clone": "Clone",
"profiles.clone_dialog_title": "Clone Profile",
"profiles.clone_dialog_desc": "Create a full, independent copy of \"{{name}}\". The cloned profile is separate from the source.",
@@ -314,7 +322,7 @@
"core.local_unsupported_toast": "Local core is too old",
"core.local_unsupported_hint": "Built-in plugins need dsh {{version}} or newer, so the bundled core is used instead. Update the local core before switching back to it.",
"app.dev_env": "Development",
- "app.config": "Config",
+ "app.config": "Running",
"config.application": "Application",
"config.profiles": "Profiles",
"config.plugins": "Plugins",
diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json
index d576fb36..a8efe6a5 100644
--- a/src/i18n/locales/zh-CN.json
+++ b/src/i18n/locales/zh-CN.json
@@ -185,6 +185,14 @@
"profiles.remove_confirm_desc": "确定删除档案 {{name}} 吗?将同时删除其插件与设置,此操作不可撤销。",
"profiles.remove_confirm": "删除",
"profiles.remove_failed": "删除档案失败",
+ "profiles.reset": "重置",
+ "profiles.reset_confirm_title": "重置档案",
+ "profiles.reset_confirm_desc": "确定重置档案 {{name}} 吗?将清空其插件、补丁与设置并恢复初始状态;会话记录不受影响,此操作不可撤销。",
+ "profiles.reset_confirm": "重置",
+ "profiles.reset_stopped_toast": "服务已停止 — 正在重置…",
+ "profiles.reset_success": "档案「{{name}}」已重置",
+ "profiles.reset_success_hint": "已恢复初始插件与设置",
+ "profiles.reset_failed": "重置档案失败",
"profiles.clone": "克隆",
"profiles.clone_dialog_title": "克隆档案",
"profiles.clone_dialog_desc": "将「{{name}}」全量复制为一个独立档案。新档案与源档案互不影响,克隆后独立使用。",
@@ -314,7 +322,7 @@
"core.local_unsupported_toast": "本地核心版本过低",
"core.local_unsupported_hint": "内置插件需要 dsh {{version}} 及以上,已自动改用预打包核心。请先更新本地核心,再切换回它。",
"app.dev_env": "开发环境",
- "app.config": "配置",
+ "app.config": "运行配置",
"config.application": "应用",
"config.profiles": "档案",
"config.plugins": "插件",
diff --git a/src/store/modules/harness/index.ts b/src/store/modules/harness/index.ts
index 13d836f2..69b4d296 100644
--- a/src/store/modules/harness/index.ts
+++ b/src/store/modules/harness/index.ts
@@ -11,3 +11,4 @@ export type {
SidebarBusyAction,
StartupError,
} from './types'
+export { waitForHarnessStopped } from './utils'
diff --git a/src/store/modules/harness/utils.ts b/src/store/modules/harness/utils.ts
index 0d95ecb9..73a95601 100644
--- a/src/store/modules/harness/utils.ts
+++ b/src/store/modules/harness/utils.ts
@@ -2,6 +2,7 @@
import type { ReadinessPollResult, ReadinessProbeResult, StartupPhase } from './readiness'
import type { InternalPluginsPhasePayload, StartupError } from './types'
import type { PatchEntryStripReport, PatchQuarantineReport } from '@/types/plugin'
+import { promiseTimeout } from '@reause/core'
import { invoke } from '@tauri-apps/api/core'
import i18next from 'i18next'
import { containsInotifyLimitError, pickErrorLines } from '@/components/logs.utils'
@@ -40,6 +41,34 @@ export function generateTimestampedUrl(baseUrl: string): string {
return `${baseUrl}${separator}t=${timestamp}`
}
+/**
+ * 轮询 health check 确认 DSH 服务已真正停止,避免改写档案目录时撞文件锁。
+ *
+ * - 使用剩余 timeout 约束 in-flight 的 probe(reause `promiseTimeout`),防止无限挂起
+ * - 仅当 health check 明确失败(非 transient 错误)时才视为已停止
+ * - 超时后继续执行(shutdown 可能仍在进行中)
+ */
+export async function waitForHarnessStopped(timeoutMs = 10_000, intervalMs = 500): Promise<void> {
+ const start = Date.now()
+ while (Date.now() - start < timeoutMs) {
+ const remaining = timeoutMs - (Date.now() - start)
+ if (remaining <= 0)
+ break
+ try {
+ await Promise.race([invoke('proxy_health_check'), promiseTimeout(remaining, true, 'probe timeout')])
+ }
+ catch (e) {
+ // probe 超时视为已停止
+ if (e instanceof Error && e.message === 'probe timeout')
+ return
+ // 非 transient 错误视为已停止;transient 错误(502 等)继续重试
+ if (!(e instanceof Error) || !/502|ECONNREFUSED|ETIMEDOUT/i.test(e.message))
+ return
+ }
+ await promiseTimeout(intervalMs)
+ }
+}
+
/** 通过 Rust 代理探测服务健康状态(超时 8s,网络抖动时重试) */
export async function checkHealthViaProxy(): Promise<ReadinessProbeResult> {
let timeoutId: ReturnType<typeof setTimeout> | undefined
diff --git a/src/ui/config/backup.tsx b/src/ui/config/backup.tsx
index ac17fb3a..e28658de 100644
--- a/src/ui/config/backup.tsx
+++ b/src/ui/config/backup.tsx
@@ -1,7 +1,7 @@
import { ArrowLeft, Delete } from '@gravity-ui/icons'
import { Button, Checkbox, Chip, Description, Label, Spinner } from '@heroui/react'
import { useOverlay } from '@overlastic/react'
-import { promiseTimeout, useToggle } from '@reause/core'
+import { useToggle } from '@reause/core'
import { invoke } from '@tauri-apps/api/core'
import { useTranslation } from 'react-i18next'
import { If } from 'react-if-lite'
@@ -10,6 +10,7 @@ import { Modal } from '@/components/modal'
import { Panel } from '@/components/panel'
import { useBackups } from '@/hooks/use-backup'
import { store } from '@/store'
+import { waitForHarnessStopped } from '@/store/modules/harness'
import { silence } from '@/utils/silence'
import { toast } from '@/utils/toast'
@@ -22,34 +23,6 @@ function formatSize(bytes: number): string {
return `${(bytes / 1024 / 1024).toFixed(1)}`
}
-/**
- * 轮询 health check 确认 DSH 服务已真正停止,避免文件锁冲突。
- * - 使用剩余 timeout 约束 in-flight 的 probe(reause `promiseTimeout`),防止无限挂起
- * - 仅当 health check 明确失败(非 transient 错误)时才视为已停止
- * - 超时后继续执行(shutdown 可能仍在进行中)
- */
-async function waitForHarnessStopped(timeoutMs = 10_000, intervalMs = 500): Promise<void> {
- const start = Date.now()
- while (Date.now() - start < timeoutMs) {
- const remaining = timeoutMs - (Date.now() - start)
- if (remaining <= 0)
- break
- try {
- await Promise.race([invoke('proxy_health_check'), promiseTimeout(remaining, true, 'probe timeout')])
- // 服务仍在运行,继续等待
- }
- catch (e) {
- // probe 超时视为已停止
- if (e instanceof Error && e.message === 'probe timeout')
- return
- // 非 transient 错误视为已停止;transient 错误(502 等)继续重试
- if (!(e instanceof Error) || !/502|ECONNREFUSED|ETIMEDOUT/i.test(e.message))
- return
- }
- await promiseTimeout(intervalMs)
- }
-}
-
export function ConfigBackup({ onBack }: ConfigBackupProps) {
const { t } = useTranslation()
const { backups, loading, error, createBackup, restoreBackup, deleteBackup, busy, creating, restoring, deleting } = useBackups()
diff --git a/src/ui/config/profile.tsx b/src/ui/config/profile.tsx
index e685115d..2831bd7f 100644
--- a/src/ui/config/profile.tsx
+++ b/src/ui/config/profile.tsx
@@ -16,6 +16,7 @@ import { Panel } from '@/components/panel'
import { queryKeys } from '@/config/query-keys'
import { useInvalidateOnSettingUpdated } from '@/hooks/use-invalidate-on-setting-updated'
import { store } from '@/store'
+import { waitForHarnessStopped } from '@/store/modules/harness'
import { ConfigBackup } from '@/ui/config/backup'
import { silence } from '@/utils/silence'
import { toast } from '@/utils/toast'
@@ -55,6 +56,10 @@ export function ConfigProfile() {
mutationFn: (id: string) => invoke<void>('remove_profile', { id }),
onSuccess: invalidate,
})
+ const reset = useMutation({
+ mutationFn: (id: string) => invoke<void>('reset_profile', { id }),
+ onSuccess: invalidate,
+ })
const clone = useMutation({
mutationFn: (params: { sourceId: string, name: string }) => invoke<Profile>('clone_profile', params),
onSuccess: invalidate,
@@ -78,6 +83,11 @@ export function ConfigProfile() {
await refetch()
}
+ async function resetProfile(id: string) {
+ await reset.mutateAsync(id)
+ await refetch()
+ }
+
async function cloneProfile(sourceId: string, name: string): Promise<Profile> {
const created = await clone.mutateAsync({ sourceId, name })
await refetch()
@@ -87,8 +97,8 @@ export function ConfigProfile() {
const profiles = profileList ?? []
const loading = isLoading
const error = profileError ? String(profileError) : ''
- /** 操作进行中标记(新建/切换/删除/克隆任一) */
- const busy = create.isPending || activate.isPending || remove.isPending || clone.isPending
+ /** 操作进行中标记(新建/切换/删除/重置/克隆任一) */
+ const busy = create.isPending || activate.isPending || remove.isPending || reset.isPending || clone.isPending
const [dialogHolder, openDialog] = useOverlay(Modal, { type: 'holder' })
@@ -237,6 +247,69 @@ export function ConfigProfile() {
}
}
+ /**
+ * 重置档案:清空档案数据(插件/补丁/设置)后按模板重新初始化。
+ *
+ * 会话存放在 `$DSH_HOME/sessions`(档案目录之外),重置不受影响。
+ * 只有当前使用中的档案会被运行中的服务锁住目录,因此仅此时沿用备份还原的编排
+ * (先停服务并确认已停止,再重置,最后重新拉起);重置其余档案不打扰在跑的服务。
+ */
+ async function onReset(id: string) {
+ const target = profiles.find(p => p.id === id)
+ if (!target || busy)
+ return
+ try {
+ await openDialog({
+ status: 'danger',
+ title: t('profiles.reset_confirm_title'),
+ description: (
+ <p>
+ {t('profiles.reset_confirm_desc', { name: target.name })}
+ </p>
+ ),
+ confirmText: t('profiles.reset_confirm'),
+ })
+ }
+ catch (e) {
+ silence(e, 'profile reset: dialog cancelled')
+ return
+ }
+ if (target.active) {
+ toast(t('profiles.reset_stopped_toast'), { variant: 'accent' })
+ try {
+ await invoke('shutdown_harness')
+ }
+ catch (e) {
+ console.warn('[ConfigProfile] shutdown_harness failed (may already be stopped):', e)
+ }
+ await waitForHarnessStopped()
+ }
+ try {
+ await resetProfile(id)
+ if (target.active) {
+ invoke('launch_harness').catch((e) => {
+ console.warn('[ConfigProfile] launch_harness failed:', e)
+ })
+ }
+ const key = toast(t('profiles.reset_success', { name: target.name }), {
+ variant: 'accent',
+ description: t('profiles.reset_success_hint'),
+ timeout: 10_000,
+ actionProps: {
+ children: t('app.restart'),
+ onPress: () => {
+ store.harness.restart()
+ toast.close(key)
+ },
+ },
+ })
+ }
+ catch (err) {
+ console.error('[ConfigProfile] reset failed:', err)
+ toast(t('profiles.reset_failed'), {})
+ }
+ }
+
// 备份子视图:点击档案的「备份」芯片后进入
if (activeView !== 'list') {
return (
@@ -305,18 +378,22 @@ export function ConfigProfile() {
{t('profiles.clone')}
</Chip>
<Chip
- className={`rounded-md${profile.default || busy ? ' cursor-not-allowed opacity-50' : ' cursor-pointer'}`}
- variant={profile.default ? 'soft' : 'primary'}
- color={profile.default ? 'default' : 'danger'}
+ className={`rounded-md${busy ? ' cursor-not-allowed opacity-50' : ' cursor-pointer'}`}
+ variant="primary"
+ color="danger"
size="sm"
onClick={(event) => {
event.stopPropagation()
- if (profile.default || busy)
+ if (busy)
+ return
+ if (profile.default) {
+ onReset(profile.id)
return
+ }
onRemove(profile.id)
}}
>
- {t('profiles.remove')}
+ {profile.default ? t('profiles.reset') : t('profiles.remove')}
</Chip>
</>
)}
diff --git a/test/clone-profile.test.ts b/test/clone-profile.test.ts
index ee22cdb0..24c991e5 100644
--- a/test/clone-profile.test.ts
+++ b/test/clone-profile.test.ts
@@ -46,15 +46,16 @@ describe('cloneProfile mutation shape', () => {
})
describe('clone Chip + naming dialog in ConfigProfile', () => {
- it('renders a Clone Chip on non-default rows with profiles.clone label', () => {
+ it('renders Clone + Delete Chips on non-default rows and a Reset Chip on the default row', () => {
const source = profileSource()
expect(source).toMatch(/profiles\.clone['"]/)
expect(source).toMatch(/profiles\.remove['"]/)
- // 删除芯片常驻所有行:默认档案渲染为灰色不可用,而非整体隐藏。
+ // 默认档案渲染「重置」(不可删除),非默认档案渲染「删除」。
+ expect(source).toMatch(/profiles\.reset['"]/)
expect(chipOf(source, `t('profiles.remove')`)).toContain('cursor-not-allowed opacity-50')
- // Clone Chip 必须排在删除 Chip 之前。
+ // Clone Chip 必须排在删除/重置 Chip 之前。
const cloneIndex = source.indexOf(`t('profiles.clone')`)
const removeIndex = source.indexOf(`t('profiles.remove')`)
expect(cloneIndex).toBeGreaterThan(-1)
@@ -107,6 +108,47 @@ describe('clone Chip + naming dialog in ConfigProfile', () => {
})
})
+describe('reset profile (default row)', () => {
+ it('invokes reset_profile and gates it behind a danger confirm dialog', () => {
+ const source = profileSource()
+
+ expect(source).toMatch(/invoke\s*<\s*void\s*>\s*\(\s*['"]reset_profile['"]/)
+ expect(source).toMatch(/profiles\.reset_confirm_title/)
+ expect(source).toMatch(/profiles\.reset_confirm_desc/)
+ })
+
+ it('swaps the default-row Chip label from remove to reset', () => {
+ const source = profileSource()
+
+ expect(source).toMatch(/profile\.default\s*\?\s*t\(\s*['"]profiles\.reset['"]\s*\)\s*:\s*t\(\s*['"]profiles\.remove['"]\s*\)/)
+ })
+
+ it('stops the harness and waits before resetting, then relaunches', () => {
+ const source = profileSource()
+ const resetIndex = source.indexOf('async function onReset')
+ expect(resetIndex).toBeGreaterThan(-1)
+ const handler = source.slice(resetIndex, source.indexOf('// 备份子视图', resetIndex))
+
+ expect(handler).toContain('shutdown_harness')
+ expect(handler).toContain('waitForHarnessStopped')
+ expect(handler).toContain('resetProfile(id)')
+ expect(handler).toContain('launch_harness')
+ // 重置是不可撤销的破坏性操作,必须走 danger 确认。
+ expect(handler).toMatch(/status:\s*['"]danger['"]/)
+ // 只有使用中的档案会被运行中的服务锁住目录,停/起服务必须以此为条件,
+ // 否则重置非当前档案会白白打断在跑的服务。
+ expect(handler).toMatch(/if\s*\(\s*target\.active\s*\)/)
+ })
+
+ it('keeps the reset Chip disabled while busy', () => {
+ const source = profileSource()
+ const busyIndex = source.indexOf('const busy =')
+ const busy = source.slice(busyIndex, source.indexOf('\n', busyIndex))
+
+ expect(busy).toContain('reset.isPending')
+ })
+})
+
describe('i18n parity', () => {
const keys = [
'profiles.clone',
@@ -122,6 +164,14 @@ describe('i18n parity', () => {
'profiles.clone_exists',
'profiles.clone_empty',
'profiles.clone_invalid',
+ 'profiles.reset',
+ 'profiles.reset_confirm_title',
+ 'profiles.reset_confirm_desc',
+ 'profiles.reset_confirm',
+ 'profiles.reset_stopped_toast',
+ 'profiles.reset_success',
+ 'profiles.reset_success_hint',
+ 'profiles.reset_failed',
]
for (const locale of ['zh-CN', 'en-US']) {