mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-09 18:06:45 +08:00
* feat(i18n): add zh-Hant locale to web and desktop Add Traditional Chinese (zh-Hant) as a supported locale with a full translation of the shared views bundles. Browser tags zh-TW/zh-HK/ zh-Hant now resolve to zh-Hant instead of collapsing to zh-Hans; the document lang is zh-TW, and docs/use-case links reuse the /zh pages. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit a6b3f6ba53a605c3e06fd6c4d30fd9df6fca8645) * feat(mobile): add zh-Hant locale Ship Traditional Chinese bundles for mobile and resolve zh-Hant/TW/HK/MO device locales to them instead of falling back to English. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 04563c22662bdb735a9a6c04be784abd9f87da06) * feat(ui-lab): add zh-Hant locale Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 1351ea572ed5d885d8a29034d6c0317de58641ea) * feat(server): accept zh-Hant as user language Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 50dfe77a4c45452fc877c62497aba226d5aaa426) * fix(i18n): sync zh-Hant with upstream copy changes Upstream added conversation-starter, instruction-preview and board column strings, removed restated descriptions (MUL-8162) and renamed Qoder Cloud Agents. Mirror those key additions, removals and rewordings in zh-Hant so the locale parity test passes. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 3a97dfc7e0bbf7568925f735c00fc69b6d94313d) * fix(i18n): add zh-Hant copy for member-scoped runtime visibility Mirror the runtime visibility "members" choice and the reworded revoke dialog in zh-Hant so the locale parity test keeps passing. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(i18n): replace Mainland terms in zh-Hant copy with Taiwan usage Several zh-Hant strings were converted character by character from zh-Hans and kept Mainland vocabulary, which reads wrong to Traditional Chinese users: 郵箱 → 信箱, 賬單/賬號 → 帳單/帳號, and similar. Values only; no keys added or removed. * fix(i18n): polish zh-Hant copy from review - 分割槽 → 分區 and 許可權 → 權限 (OpenCC phrase mis-conversions) - drop stray blank lines before zh-Hant workspace names Co-authored-by: multica-agent <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Multica Eve <[email protected]> Co-authored-by: multica-agent <[email protected]>
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import { loader } from "fumadocs-core/source";
|
|
import { defineI18n } from "fumadocs-core/i18n";
|
|
import type { SupportedLocale } from "@multica/core/i18n";
|
|
import { useCases } from "@/.source";
|
|
import { mergeUseCasePagesWithEnglishFallback } from "./use-case-locale-fallback";
|
|
|
|
// Use-case content uses dot-suffixed MDX files (`<slug>.en.mdx`,
|
|
// `<slug>.zh.mdx`, `<slug>.ko.mdx`, and `<slug>.ja.mdx`). The public route remains prefix-free; request locale is
|
|
// resolved through the same cookie/header path as the rest of the web app.
|
|
export const i18n = defineI18n({
|
|
languages: ["en", "zh", "ko", "ja"],
|
|
defaultLanguage: "en",
|
|
hideLocale: "default-locale",
|
|
parser: "dot",
|
|
});
|
|
|
|
export type UseCaseLang = (typeof i18n.languages)[number];
|
|
|
|
export function getUseCaseLangForLocale(locale: SupportedLocale): UseCaseLang {
|
|
if (locale === "zh-Hans" || locale === "zh-Hant") return "zh";
|
|
if (locale === "ko") return "ko";
|
|
if (locale === "ja") return "ja";
|
|
return "en";
|
|
}
|
|
|
|
export const useCasesSource = loader({
|
|
baseUrl: "/usecases",
|
|
source: useCases.toFumadocsSource(),
|
|
i18n,
|
|
});
|
|
|
|
export function getUseCasePagesForLocale(locale: SupportedLocale) {
|
|
const lang = getUseCaseLangForLocale(locale);
|
|
const pages = useCasesSource.getPages(lang);
|
|
|
|
if (lang === i18n.defaultLanguage) return pages;
|
|
|
|
return mergeUseCasePagesWithEnglishFallback(
|
|
pages,
|
|
useCasesSource.getPages(i18n.defaultLanguage),
|
|
);
|
|
}
|
|
|
|
export function getUseCasePageForLocale(
|
|
slugs: string[],
|
|
locale: SupportedLocale,
|
|
) {
|
|
const lang = getUseCaseLangForLocale(locale);
|
|
const page = useCasesSource.getPage(slugs, lang);
|
|
|
|
if (page || lang === i18n.defaultLanguage) return page;
|
|
|
|
return useCasesSource.getPage(slugs, i18n.defaultLanguage);
|
|
}
|