From 2fc1c3aef1e7934efeb1125210f4b97dbbb17414 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Wed, 03 Jun 2026 18:36:42 +0800
Subject: [PATCH] Fix engine status updates after model reload

---
 privatevoice.src/frontend/src/lib/i18n/index.ts |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/privatevoice.src/frontend/src/lib/i18n/index.ts b/privatevoice.src/frontend/src/lib/i18n/index.ts
index ec9e004..307f660 100755
--- a/privatevoice.src/frontend/src/lib/i18n/index.ts
+++ b/privatevoice.src/frontend/src/lib/i18n/index.ts
@@ -1,9 +1,11 @@
 import zh from "./zh.json";
 import en from "./en.json";
+import { writable } from "svelte/store";
 
-type Locale = "zh" | "en";
+export type Locale = "zh" | "en";
 
 const translations: Record<Locale, Record<string, any>> = { zh, en };
+export const localeRevision = writable(0);
 
 // Detect system language, default to Chinese
 function detectLocale(): Locale {
@@ -14,8 +16,16 @@
 
 let currentLocale: Locale = detectLocale();
 
-export function setLocale(locale: Locale) {
-  currentLocale = locale;
+function normalizeLocale(locale: string): Locale {
+  return locale.toLowerCase().startsWith("zh") ? "zh" : "en";
+}
+
+export function setLocale(locale: Locale | string) {
+  const next = normalizeLocale(locale);
+  if (currentLocale !== next) {
+    currentLocale = next;
+    localeRevision.update((value) => value + 1);
+  }
 }
 
 export function getLocale(): Locale {

--
Gitblit v1.9.3