@endif
```
## Routes
### Language Switching
- `GET /language/{locale}` - Switch language
- `GET /api/language/current` - Get current language info
### Localized Routes
All main routes support optional locale prefix:
- `/{locale?}/` - Home
- `/{locale?}/about` - About
- `/{locale?}/services` - Services
- etc.
## Middleware
### SetLocale Middleware
Automatically applied to all localized routes:
1. Detects locale from URL, session, or browser
2. Sets application locale
3. Stores locale in session
## Database Changes
### Contact Submissions
```sql
ALTER TABLE contact_submissions ADD COLUMN locale VARCHAR(5) DEFAULT 'en';
```
### Newsletter Subscriptions
```sql
ALTER TABLE newsletter_subscriptions ADD COLUMN locale VARCHAR(5) DEFAULT 'en';
```
## SEO Considerations
### Hreflang Tags
Add to `` section:
```html
```
### Language-specific Meta Tags
Each language has its own:
- Title tags
- Meta descriptions
- Keywords
- Open Graph tags
## Testing
### Language Switching
1. Visit homepage
2. Click language switcher
3. Select different language
4. Verify content changes
5. Check URL includes locale prefix
### RTL Languages
1. Switch to Arabic
2. Verify text direction changes
3. Check navigation alignment
4. Test form layouts
### Browser Detection
1. Change browser language settings
2. Visit site in incognito mode
3. Verify automatic language detection
## Adding New Languages
### 1. Update Configuration
Add to `config/app.php`:
```php
'supported_locales' => [
// existing languages...
'pt' => 'Português',
'ru' => 'Русский',
],
```
### 2. Create Translation File
Create `resources/lang/{locale}/messages.php` with all translations.
### 3. Add Flag to Language Switcher
Update `resources/views/components/language-switcher.blade.php`:
```php
@case('pt')
🇵🇹
@break
```
### 4. Test New Language
- Switch to new language
- Verify all translations work
- Check URL structure
- Test forms and messages
## Performance Optimization
### Caching Translations
```bash
php artisan config:cache
php artisan route:cache
```
### Lazy Loading
Only load translation files for current locale.
### CDN Considerations
Serve different cached versions for each language.
## Maintenance
### Translation Updates
1. Update translation files in `resources/lang/`
2. Clear cache: `php artisan config:clear`
3. Test changes across all languages
### Adding New Content
1. Add translation keys to all language files
2. Use `__('messages.new_key')` in templates
3. Test in all supported languages
## Troubleshooting
### Language Not Switching
- Check middleware is applied to routes
- Verify session storage is working
- Clear route/config cache
### Missing Translations
- Check translation key exists in all language files
- Verify file naming convention
- Clear application cache
### RTL Layout Issues
- Check CSS RTL overrides
- Verify Bootstrap RTL classes
- Test with Arabic content
## Future Enhancements
### Potential Additions
- **More Languages**: Add based on user demand
- **Admin Panel**: Manage translations through web interface
- **Translation API**: Integrate with Google Translate for missing keys
- **Language Analytics**: Track most used languages
- **Regional Variants**: Support for en-US, en-GB, etc.
- **Currency Localization**: Show prices in local currencies
- **Date/Time Formatting**: Locale-specific date formats