nomadro/src/modules/social/lib/socialTx.ts
Eric ffa456afdf Ship social join profile + SeaweedFS avatars, notify/coffee, and .com audience stack.
Pay-then-profile join desk with live card, S3 upload fallback, hydration-safe drafts; document on test9 README.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-04 02:25:05 +08:00

21 lines
654 B
TypeScript

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;
}