Adding New Locales
Add a locale
Section titled “Add a locale”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:
npx tyndale translatetranslate auto-runs extraction first, then generates translations for the new locale while leaving existing locale files alone unless stale entries need cleanup.
Locale aliases
Section titled “Locale aliases”Map variant codes to canonical ones with localeAliases:
{ "localeAliases": { "pt-BR": "pt", "zh-TW": "zh" }}RTL support
Section titled “RTL support”Tyndale detects RTL locales, but it does not mutate <html dir> for you. Wire direction explicitly with the current locale helpers:
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.