Skip to content

Adding New Locales

Open tyndale.config.json and add the locale code to the locales array:

{
"defaultLocale": "en",
"locales": ["es", "fr", "ja", "de"]
}

defaultLocale is your source language, so it must not appear in locales.

Then run:

Terminal window
npx tyndale translate

translate auto-runs extraction first, then generates translations for the new locale while leaving existing locale files alone unless stale entries need cleanup.

Map variant codes to canonical ones with localeAliases:

{
"localeAliases": {
"pt-BR": "pt",
"zh-TW": "zh"
}
}

Tyndale detects RTL locales, but it does not mutate <html dir> for you. Wire direction explicitly with the current locale helpers:

app/[locale]/layout.tsx
import { getDirection } from 'tyndale-next/server';
export default async function RootLayout({
children,
params,
}: {
children: React.ReactNode;
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
return (
<html lang={locale} dir={getDirection(locale)}>
<body>{children}</body>
</html>
);
}

In client components, use useDirection() when you need the active direction value inside rendered UI.