import { SOCIAL_PHRASES_EN } from "./phrases"; import type { SocialLocale } from "./i18n"; let activeLocale: SocialLocale = "zh"; /** Sync from SocialExperience / useSocialI18n so nested helpers can translate without hooks. */ export function setSocialTxLocale(locale: SocialLocale) { activeLocale = locale; } export function getSocialTxLocale(): SocialLocale { return activeLocale; } /** Translate a Chinese UI string when active locale is English. */ export function socialTx(zh: string, en?: string): string { if (activeLocale === "zh") return zh; if (en) return en; return SOCIAL_PHRASES_EN[zh] || SOCIAL_PHRASES_EN[zh.trim()] || zh; }