From cfe4d647b4d7cc1ae41d7e193d45d546ae15b244 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Fri, 05 Jun 2026 02:18:56 +0800
Subject: [PATCH] Sign Mac App Store app identifier entitlement
---
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