import type { Metadata } from "next" import { getTranslations, getMessages, setRequestLocale } from "next-intl/server" import { Link } from "@/i18n/navigation" import { DocHeader } from "@/components/ui/doc-header" import { Callout } from "@/components/ui/callout" export async function generateMetadata({ params, }: { params: Promise<{ locale: string }> }): Promise { const { locale } = await params const t = await getTranslations({ locale, namespace: "docs.settings.changeLanguage.meta" }) return { title: t("title"), description: t("description"), openGraph: { title: t("ogTitle"), description: t("ogDescription"), type: "article", url: "https://macrimi.github.io/ProxMenux/docs/settings/change-language", }, } } type LangRow = { code: string; lang: string; notes: string } type StringItem = string type RelatedItem = { href: string; label: string; tail?: string } export default async function ChangeLanguagePage({ params, }: { params: Promise<{ locale: string }> }) { const { locale } = await params setRequestLocale(locale) const t = await getTranslations({ locale, namespace: "docs.settings.changeLanguage" }) const messages = (await getMessages({ locale })) as unknown as { docs: { settings: { changeLanguage: { supported: { rows: LangRow[] } underHood: { items: StringItem[] } related: { items: RelatedItem[] } } } } } const langRows = messages.docs.settings.changeLanguage.supported.rows const underHoodItems = messages.docs.settings.changeLanguage.underHood.items const relatedItems = messages.docs.settings.changeLanguage.related.items const code = (chunks: React.ReactNode) => {chunks} const em = (chunks: React.ReactNode) => {chunks} return (
{t.rich("intro.body", { code })} {t.rich("warn.body", { code, em })}

{t("supported.heading")}

{langRows.map((row, idx) => ( ))}
{t("supported.headerCode")} {t("supported.headerLang")} {t("supported.headerNotes")}
{row.code} {row.lang} {row.notes}
{t("englishTip.body")}

{t("underHood.heading")}

    {underHoodItems.map((_, idx) => (
  1. {t.rich(`underHood.items.${idx}`, { code, em })}
  2. ))}

{t("manual.heading")}

{`# Set language to Spanish
tmp=$(mktemp)
jq --arg lang "es" '.language = $lang' /usr/local/share/proxmenux/config.json > "$tmp" \\
    && mv "$tmp" /usr/local/share/proxmenux/config.json

# Verify
jq -r '.language' /usr/local/share/proxmenux/config.json`}

{t("troubleshoot.heading")}

{t("troubleshoot.noOptionBody")} {t.rich("troubleshoot.stillEnglishBody", { code })}

{t("related.heading")}

    {relatedItems.map((item) => (
  • {item.label} {item.tail}
  • ))}
) }