Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go
1.2 KB
Raw Blame
import { matchLocale, type SupportedLocale } from "@multica/core/i18n";

export {
  INSTALL_RUNTIME_ISSUE_TITLE,
  INSTALL_RUNTIME_ISSUE_BODY,
} from "./install-runtime-issue";
export {
  getMikaOnboarding,
  type MikaContentLang,
  type MikaOnboardingDefinition,
} from "./mika";
type ContentLang = "en" | "zh" | "ko" | "ja";

const CONTENT_LANG_BY_LOCALE: Record<SupportedLocale, ContentLang> = {
  en: "en",
  "zh-Hans": "zh",
  // No Traditional Chinese variant yet; the Simplified copy is closer to
  // readable than the English fallback.
  "zh-Hant": "zh",
  ko: "ko",
  ja: "ja",
  // Mika's onboarding content has no French, Spanish or Russian variant yet.
  // Those users read the English copy rather than an untranslated placeholder.
  fr: "en",
  es: "en",
  ru: "en",
};

/**
 * Pick persisted onboarding content for the given user language. Maps
 * supported BCP-47 prefixes to the matching variant; everything else falls
 * back to English. Mirrors the locale picker used by the frontend i18n layer.
 */
export function pickContentLang(
  language: string | null | undefined,
): ContentLang {
  return CONTENT_LANG_BY_LOCALE[matchLocale(language ? [language] : [])];
}