This guide covers the comprehensive internationalization (i18n) features of the Filament PWA plugin, including built-in translations for 10+ languages and full RTL/LTR support.
The Filament PWA plugin includes comprehensive internationalization support with:
The plugin includes complete translations for the following languages:
| Language | Code | Direction | Script | Status |
|---|---|---|---|---|
| English | en |
LTR | Latin | ✅ Complete |
| Arabic | ar |
RTL | Arabic | ✅ Complete |
| Spanish | es |
LTR | Latin | ✅ Complete |
| French | fr |
LTR | Latin | ✅ Complete |
| German | de |
LTR | Latin | ✅ Complete |
| Portuguese | pt |
LTR | Latin | ✅ Complete |
| Italian | it |
LTR | Latin | ✅ Complete |
| Russian | ru |
LTR | Cyrillic | ✅ Complete |
| Japanese | ja |
LTR | Japanese | ✅ Complete |
| Chinese (Simplified) | zh-CN |
LTR | Chinese | ✅ Complete |
| Dutch | nl |
LTR | Latin | ✅ Complete |
Each language includes translations for:
The plugin automatically detects language and text direction from your Laravel application configuration.
// Laravel app configuration (config/app.php)
'locale' => 'ar',
// The PWA plugin automatically detects and uses Arabic
FilamentPwaPlugin::make()
// No language configuration needed - automatically uses 'ar'
The plugin automatically detects RTL languages and sets the appropriate text direction:
// RTL languages automatically detected:
$rtlLanguages = ['ar', 'he', 'fa', 'ur', 'ku', 'dv', 'ps', 'sd', 'yi'];
// If Laravel locale is 'ar', PWA automatically sets dir="rtl"
When automatic detection is not possible, the plugin falls back to sensible defaults:
'en' (English)'ltr' (Left-to-right)You can override automatic detection with manual configuration.
FilamentPwaPlugin::make()
->language('ar') // Set Arabic
->direction('rtl') // Set right-to-left
// Convenience methods
->rtl() // Same as direction('rtl')
->ltr() // Same as direction('ltr')
Use closures for user-specific language preferences:
FilamentPwaPlugin::make()
->language(fn() => auth()->user()?->language ?? app()->getLocale())
->direction(fn() => auth()->user()?->text_direction ?? 'ltr')
FilamentPwaPlugin::make()
->language(fn() => match(app()->environment()) {
'production' => 'en',
'staging' => 'es',
default => app()->getLocale()
})
The plugin provides comprehensive RTL (Right-to-Left) language support.
RTL languages are automatically detected and configured:
// Supported RTL languages
$rtlLanguages = [
'ar', // Arabic
'he', // Hebrew
'fa', // Persian/Farsi
'ur', // Urdu
'ku', // Kurdish
'dv', // Divehi
'ps', // Pashto
'sd', // Sindhi
'yi', // Yiddish
];
For RTL languages, the plugin automatically:
"dir": "rtl"// Set Laravel locale to Arabic
app()->setLocale('ar');
FilamentPwaPlugin::make()
// Automatically detects Arabic and sets:
// - language: 'ar'
// - direction: 'rtl'
// - Uses Arabic translations from resources/lang/ar/pwa.php
FilamentPwaPlugin::make()
->language('ar')
->rtl() // Explicitly set RTL
You can customize existing translations or add new ones.
First, publish the language files:
php artisan vendor:publish --tag="filament-pwa-lang"
This creates translation files in resources/lang/{locale}/pwa.php.
Edit the published translation files:
// resources/lang/ar/pwa.php
return [
'install_title' => 'تثبيت التطبيق المخصص', // Custom Arabic translation
'install_description' => 'احصل على تجربة محسنة مع التطبيق المثبت',
'install_button' => 'تثبيت الآن',
'dismiss_button' => 'إغلاق',
// ... rest of translations
];
You can override specific translation keys without publishing all files:
// In a service provider
public function boot()
{
// Override specific Arabic translations
Lang::addLines([
'filament-pwa::pwa.install_title' => 'تثبيت التطبيق المخصص',
'filament-pwa::pwa.install_description' => 'وصف مخصص للتثبيت',
], 'ar');
}
To add support for a new language:
# Copy the English template
cp resources/lang/en/pwa.php resources/lang/your-locale/pwa.php
Edit the new file and translate all strings:
// resources/lang/your-locale/pwa.php
return [
// Installation prompts
'install_title' => 'Your Translation',
'install_description' => 'Your Translation',
'install_button' => 'Your Translation',
'dismiss_button' => 'Your Translation',
// iOS installation
'ios_install_title' => 'Your Translation',
'ios_install_description' => 'Your Translation',
'ios_step_1' => 'Your Translation',
'ios_step_2' => 'Your Translation',
'ios_step_3' => 'Your Translation',
'got_it' => 'Your Translation',
// ... continue with all keys
];
FilamentPwaPlugin::make()
->language('your-locale')
->direction('ltr') // or 'rtl' for RTL languages
Test your translations by setting the Laravel locale:
app()->setLocale('your-locale');
install_title - Main installation prompt titleinstall_description - Installation prompt descriptioninstall_button - Install button textdismiss_button - Dismiss button textios_install_title - iOS installation modal titleios_install_description - iOS installation descriptionios_step_1 - First step instructionios_step_2 - Second step instructionios_step_3 - Third step instructiongot_it - Confirmation buttonupdate_available - Update notification titleupdate_description - Update descriptionupdate_now - Update button textupdate_later - Later button textoffline_title - Offline page titleoffline_subtitle - Offline page descriptionoffline_status - Offline status indicatoronline_status - Online status indicatoroffline_indicator - No connection messageavailable_features - Available features titlefeature_cached_pages - Cached pages descriptionfeature_offline_forms - Offline forms descriptionfeature_local_storage - Local storage descriptionfeature_auto_sync - Auto sync descriptionretry_connection - Retry connection buttongo_home - Go home buttonvalidation.manifest_missing - Manifest not found errorvalidation.service_worker_missing - Service worker not found errorvalidation.icons_missing - Icons not found errorvalidation.https_required - HTTPS required errorsetup.starting - Setup starting messagesetup.publishing_assets - Publishing assets messagesetup.generating_icons - Generating icons messagesetup.validating - Validating setup messagesetup.completed - Setup completed messagesetup.assets_published - Assets published messagesetup.icons_generated - Icons generated messagesetup.validation_passed - Validation passed messagesetup.validation_failed - Validation failed messageAlways maintain the exact array structure when translating:
// ✅ Correct - maintains structure
'validation' => [
'manifest_missing' => 'Your translation',
'service_worker_missing' => 'Your translation',
],
// ❌ Incorrect - changes structure
'validation_manifest_missing' => 'Your translation',
Keep placeholder variables unchanged:
// ✅ Correct - preserves :attribute placeholder
'validation_failed' => 'PWA validation failed: :attribute',
// ❌ Incorrect - removes placeholder
'validation_failed' => 'PWA validation failed',
Ensure translations are culturally appropriate:
// For Arabic - use formal, respectful language
'install_description' => 'احصل على تجربة أفضل مع التطبيق المثبت',
// For Japanese - use polite forms
'install_description' => 'インストールされたアプリでより良い体験を得る',
For RTL languages:
Always test translations in context:
// Test with different locales
app()->setLocale('ar');
// Check PWA installation prompts
app()->setLocale('ja');
// Check PWA installation prompts
Maintain consistency across all translation keys:
How can I help you explore Laravel packages today?