mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-26 20:45:37 +02:00
* i18n: add japanese locale * fix: spacing issues * refactor * fix(desktop): set <html lang> before paint to avoid JA Kanji font flash Switch the documentElement.lang sync from useEffect to useLayoutEffect so lang is committed before the first paint. Otherwise Japanese desktop users saw one frame of Kanji rendered with the Chinese-first fallback stack before the html[lang|="ja"] CJK override applied. Also fix the stale selector in the HTML_LANG comment (html[lang^="ja"] -> html[lang|="ja"]). Addresses review nits on MUL-2893. Co-authored-by: multica-agent <github@multica.ai> * fix(docs): tokenize the ideographic iteration mark in JA search Add U+3005 (々) to the Japanese search tokenizer character class. It sits just below the kana blocks, so words like 様々 / 日々 / 個々 previously dropped the mark and split awkwardly, hurting recall. Addresses a review nit on MUL-2893. Co-authored-by: multica-agent <github@multica.ai> * fix(i18n): restore ja locale parity after merging main Merging main brought new EN strings into agents/chat/onboarding/settings/ squads that the ja bundle (authored against an older snapshot) lacked, breaking the locales parity test. Add the Japanese translations for the new keys (workspace logo upload, agents runtime filter, chat session-history stop dialog, onboarding social_github, squad archived status) and drop the two renamed chat window keys (active_group / archived_group) that EN removed in favour of history_group. Fixes the failing @multica/views parity.test.ts on the FE CI for MUL-2893. Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: J <j@multica.ai> Co-authored-by: multica-agent <github@multica.ai>
114 lines
3.4 KiB
TypeScript
114 lines
3.4 KiB
TypeScript
import "../global.css";
|
|
import { RootProvider } from "fumadocs-ui/provider";
|
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
import { Inter, Geist_Mono, Source_Serif_4 } from "next/font/google";
|
|
import type { ReactNode } from "react";
|
|
import type { Metadata } from "next";
|
|
import { cn } from "@multica/ui/lib/utils";
|
|
import { baseOptions } from "@/app/layout.config";
|
|
import { source } from "@/lib/source";
|
|
import { i18n, type Lang } from "@/lib/i18n";
|
|
import { uiTranslations, localeLabels } from "@/lib/translations";
|
|
import { DocsSettings } from "@/components/docs-settings";
|
|
|
|
// Inter (Latin UI face) is exposed under `--font-inter`. The full `--font-sans`
|
|
// stack — Inter + the per-locale CJK fallback chain, including the Japanese-first
|
|
// override scoped to `<html lang="ja">` — is composed in static CSS in
|
|
// ./global.css (CSP-safe, no inline <style>). Mirrors apps/web/app/layout.tsx.
|
|
const inter = Inter({
|
|
subsets: ["latin"],
|
|
variable: "--font-inter",
|
|
});
|
|
|
|
const geistMono = Geist_Mono({
|
|
subsets: ["latin"],
|
|
variable: "--font-mono",
|
|
fallback: ["ui-monospace", "SFMono-Regular", "Menlo", "Consolas", "monospace"],
|
|
});
|
|
|
|
// Editorial serif used for headings and showpiece elements. Italic style is
|
|
// deliberately NOT loaded — italic in CJK is a synthetic slant that breaks
|
|
// glyph design. Emphasis in docs is carried by brand color + weight, never
|
|
// font-style. Mirrors apps/web/app/layout.tsx for the upright family.
|
|
const sourceSerif = Source_Serif_4({
|
|
subsets: ["latin"],
|
|
style: ["normal"],
|
|
variable: "--font-serif",
|
|
fallback: [
|
|
"ui-serif",
|
|
"Iowan Old Style",
|
|
"Apple Garamond",
|
|
"Baskerville",
|
|
"Times New Roman",
|
|
"serif",
|
|
],
|
|
});
|
|
|
|
export const metadata: Metadata = {
|
|
title: {
|
|
template: "%s | Multica Docs",
|
|
default: "Multica Docs",
|
|
},
|
|
description:
|
|
"Documentation for Multica — the open-source managed agents platform.",
|
|
};
|
|
|
|
export function generateStaticParams() {
|
|
return i18n.languages.map((lang) => ({ lang }));
|
|
}
|
|
|
|
export default async function Layout({
|
|
params,
|
|
children,
|
|
}: {
|
|
params: Promise<{ lang: string }>;
|
|
children: ReactNode;
|
|
}) {
|
|
const { lang: rawLang } = await params;
|
|
const lang = (i18n.languages as readonly string[]).includes(rawLang)
|
|
? (rawLang as Lang)
|
|
: (i18n.defaultLanguage as Lang);
|
|
const locales = i18n.languages.map((l) => ({
|
|
locale: l,
|
|
name: localeLabels[l],
|
|
}));
|
|
|
|
return (
|
|
<html
|
|
lang={lang}
|
|
suppressHydrationWarning
|
|
className={cn(
|
|
"antialiased",
|
|
inter.variable,
|
|
geistMono.variable,
|
|
sourceSerif.variable,
|
|
)}
|
|
>
|
|
<body className="font-sans">
|
|
<RootProvider
|
|
i18n={{
|
|
locale: lang,
|
|
locales,
|
|
translations: uiTranslations[lang],
|
|
}}
|
|
search={{ options: { api: "/docs/api/search" } }}
|
|
>
|
|
<DocsLayout
|
|
tree={source.getPageTree(lang)}
|
|
// Suppress Fumadocs's default sidebar-footer icons (theme +
|
|
// language + search). Our custom <DocsSettings> is mounted as
|
|
// the sidebar footer instead — two labelled buttons, not three
|
|
// icons.
|
|
themeSwitch={{ enabled: false }}
|
|
searchToggle={{ enabled: false }}
|
|
sidebar={{ footer: <DocsSettings locale={lang} /> }}
|
|
{...baseOptions}
|
|
>
|
|
{children}
|
|
</DocsLayout>
|
|
</RootProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|