Laravel developers ditch separate tables for JSON-based translations
Multilingual Architecture via JSON Fields
Managing 10 or more languages in a modern web application requires a shift away from cumbersome relational tables toward flexible JSON structures. Using the
Global Middleware and Localized Routing
To ensure a seamless user experience, the application uses a custom SetLocale middleware. This logic extracts the language code directly from the URL prefix—such as /es/ for Spanish—and sets the application state accordingly. By validating these prefixes against a regex pattern, the system maintains
Dynamic UI via Filament Tabs
The locales configuration file. Each tab displays an emoji flag and a set of input fields.
foreach (config('locales') as $code => $locale) {
$tabs[] = Tab::make($locale['name'])
->icon($locale['flag'])
->schema([
TextInput::make("title.$code")
->required($code === 'en'),
Textarea::make("description.$code"),
]);
}

This structure ensures that only the primary language (English) requires validation, while others remain optional.
Performance Tradeoffs with Astrotomic
While JSON fields offer flexibility, high-traffic applications with heavy SQL querying might struggle with performance. In these scenarios, the