Internationalization

next-intl on the frontend, Laravel __() on the backend. Ships with English and French.

How It Works

Frontend

Uses useTranslations() with JSON files in messages/. Each namespace maps to a JSON file.

Backend

Uses Laravel's __('auth.loginSuccess') with JSON files in lang/. API responses return translated messages.

Locale Detection

Middleware reads the locale cookie first, then falls back to the Accept-Language header.

URL Strategy

Locale is stored in a cookie, not in the URL path. No /en/ or /fr/ prefixes — cleaner URLs.


Adding a Language

Add the frontend translations

Copy messages/en.json to your locale (e.g. messages/de.json) and translate the values.

Add the backend translations

Copy lang/en.json to lang/de.json and translate the values.

Update the language switcher

Add the new locale to the locales array in frontend/src/modules/i18n/components/language-switcher.tsx:

const locales = [
  { code: 'en', flag: '🇬🇧', label: 'English' },
  { code: 'fr', flag: '🇫🇷', label: 'Français' },
  { code: 'de', flag: '🇩🇪', label: 'Deutsch' },  // add your locale
]

That's it — next-intl auto-detects the new JSON file via frontend/src/i18n/request.ts. No other config needed.

Good to know

If removed via CLI, useTranslations() calls keep working with a static English fallback. No code changes needed.

Admin Dashboard Development

Documentation

Ready to build your SaaS?

Full source code, all modules, lifetime updates.

Get Stacktura — $249