mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-13 13:18:56 +02:00
* feat: add korean locale support * feat(i18n): localize Korean landing page * fix(i18n): refine Korean landing copy * fix(i18n): refine Korean translations * fix(i18n): translate Korean landing subpages * fix(i18n): route Korean landing docs links * fix(i18n): add Korean use case content * fix(i18n): polish Korean locale copy * fix(i18n): improve Korean landing copy * fix(onboarding): persist Korean helper artifacts Co-authored-by: multica-agent <github@multica.ai> * fix(web): add use case locale fallback Co-authored-by: multica-agent <github@multica.ai> * Align Korean pull requests wording Co-authored-by: multica-agent <github@multica.ai> * fix(i18n): dedupe docs href helper Co-authored-by: multica-agent <github@multica.ai> * fix(i18n): localize changelog dates Co-authored-by: multica-agent <github@multica.ai> * fix(docs): prerender Korean fallback pages Co-authored-by: multica-agent <github@multica.ai> * fix(docs): align fallback hreflang metadata Co-authored-by: multica-agent <github@multica.ai> * fix(i18n): preserve Chinese CJK font fallback order Co-authored-by: multica-agent <github@multica.ai> * chore(onboarding): update localized comment wording Co-authored-by: multica-agent <github@multica.ai> * test(i18n): harden CJK font fallback assertions Co-authored-by: multica-agent <github@multica.ai> * fix(docs): keep Chinese font fallbacks first Co-authored-by: multica-agent <github@multica.ai> * test(i18n): harden locale fallback coverage Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: multica-agent <github@multica.ai>
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { docsContentLang, i18n, type Lang } from "@/lib/i18n";
|
|
|
|
export type DocsStaticParam = {
|
|
lang: Lang;
|
|
slug: string[];
|
|
};
|
|
|
|
type SourceStaticParam = {
|
|
lang: string;
|
|
slug: string[];
|
|
};
|
|
|
|
function isLang(lang: string): lang is Lang {
|
|
return (i18n.languages as readonly string[]).includes(lang);
|
|
}
|
|
|
|
function paramKey(param: DocsStaticParam): string {
|
|
return `${param.lang}/${param.slug.join("/")}`;
|
|
}
|
|
|
|
export function docsSlugStaticParams(
|
|
params: SourceStaticParam[],
|
|
): DocsStaticParam[] {
|
|
const slugParams = params.filter(
|
|
(param): param is DocsStaticParam =>
|
|
param.slug.length > 0 && isLang(param.lang),
|
|
);
|
|
const output: DocsStaticParam[] = [];
|
|
const seen = new Set<string>();
|
|
|
|
const addParam = (param: DocsStaticParam) => {
|
|
const key = paramKey(param);
|
|
if (seen.has(key)) return;
|
|
seen.add(key);
|
|
output.push(param);
|
|
};
|
|
|
|
for (const param of slugParams) addParam(param);
|
|
|
|
for (const lang of i18n.languages) {
|
|
const contentLang = docsContentLang(lang);
|
|
if (contentLang === lang) continue;
|
|
|
|
for (const param of slugParams) {
|
|
if (param.lang !== contentLang) continue;
|
|
addParam({ lang, slug: param.slug });
|
|
}
|
|
}
|
|
|
|
return output;
|
|
}
|