feat: i18n, language switcher fix, DataTable improvements, blade translations
- Translation system: lang/es/ PHP files (auth, validation, pagination, passwords)
- Rappasoft vendor translations published (lang/vendor/livewire-tables/es/)
- JSON files synced to 391 keys (EN + ES, full parity)
- APP_LOCALE changed to 'es', users.locale column default changed to 'es'
- Language switcher fixed: JS event + window.location.reload() avoids /livewire/update redirect
- SetLocale middleware fallback uses config('app.locale') instead of hardcoded 'en'
- setSortingPillsEnabled(false) on ProjectTable, CompanyTable, UserTable
- Translated 17 blade views: project-map, template-manager, layer-manager,
company-management, phase-list, media-manager, reports-dashboard,
client-projects, layer-upload, project-form, project-map-editor-tab,
admin/users, projects/media, projects/templates, layouts/client
- Navigation 'Empresas' link uses __('Companies')
- Fixed typo key 'Fases and layers' -> 'Phases and layers'
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,20 +9,19 @@ use Illuminate\Support\Facades\Session;
|
||||
|
||||
class LanguageSwitcher extends Component
|
||||
{
|
||||
public $currentLocale;
|
||||
public string $currentLocale;
|
||||
|
||||
public function mount()
|
||||
public function mount(): void
|
||||
{
|
||||
$this->currentLocale = App::getLocale();
|
||||
}
|
||||
|
||||
public function switchLanguage($locale)
|
||||
public function switchLanguage(string $locale): void
|
||||
{
|
||||
if (!in_array($locale, ['en', 'es'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
App::setLocale($locale);
|
||||
Session::put('locale', $locale);
|
||||
|
||||
if (Auth::check()) {
|
||||
@@ -31,8 +30,10 @@ class LanguageSwitcher extends Component
|
||||
$user->save();
|
||||
}
|
||||
|
||||
$this->currentLocale = $locale;
|
||||
$this->dispatch('localeChanged', $locale);
|
||||
// Dispatch a browser event — JavaScript reloads the page.
|
||||
// PHP-side redirects break because $this->redirect() runs inside
|
||||
// /livewire/update (the AJAX endpoint), not on the real page URL.
|
||||
$this->dispatch('locale-changed');
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
||||
Reference in New Issue
Block a user