feat: i18n on Filament admin sidebar — 54 resources/pages translated
User screenshots showed the tenant admin panel (Filament) had sidebar
labels stuck in Romanian even when switching to Russian: 'Cereri',
'Calendar vizual', 'Atelierul meu', 'KPI mecanici', 'Fișe lucru',
'Norme-ore', 'Tehnicieni', 'Șabloane servicii', 'Depozite', 'Scaner',
'Depozit', 'VIN-căutare', 'Furnizori', 'Achiziții', 'Procentaj',
'Coeficienți preț', plus all group headers.
Root cause: every Filament Resource and Page had static properties
'protected static ?string $navigationLabel = "Fișe lucru"' — string
literals baked into class definitions. Static properties don't run
through the translation layer.
Fix in two parts:
1. New translation files with 52 label keys + 12 group keys:
- lang/ro/nav.php — Romanian (identity)
- lang/ru/nav.php — full Russian translations (Заказ-наряды,
Автомобили, Клиенты, Календарь, Моя мастерская, Механики KPI,
Настройки, etc.)
- lang/en/nav.php — English translations (Work orders, Vehicles,
Clients, Calendar, My workshop, Mechanic KPI, Settings, etc.)
Keyed by the Romanian original so lookups map 1:1 —
'nav.label.Fișe lucru' returns 'Заказ-наряды' in RU, 'Work orders'
in EN, 'Fișe lucru' in RO.
2. Python transformer converted 54 files:
- 33 Filament Tenant Resources
- 15 Filament Tenant Pages
- 4 Filament Central Resources
- 1 Filament Central Page
- 1 Widget
Each 'protected static ?string $navigationLabel = "X";' became
'public static function getNavigationLabel(): string { return
__("nav.label.X"); }'. Same treatment for $navigationGroup.
Cleanup: 6 resources already had manually-added getNavigationLabel
methods from an earlier partial effort — those used flat JSON keys
(__("Cereri")) that never resolved. Deduped so only the nav.label.*
version remains.
Untouched (intentional):
- $modelLabel / $pluralModelLabel (used in breadcrumbs and headings —
still hardcoded, next tier of work)
- Section titles, column headers, form field labels (medium priority)
- $navigationSort (numeric, no translation needed)
- $navigationIcon (icon reference)
Suite: 306 passed (853 assertions). Unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,9 +12,15 @@ class AiAssistant extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-sparkles';
|
||||
|
||||
protected static ?string $navigationLabel = 'Asistent AI';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Asistent AI');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Analiză';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Analiză');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 71;
|
||||
|
||||
|
||||
@@ -11,9 +11,15 @@ class ApiTokens extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-key';
|
||||
|
||||
protected static ?string $navigationLabel = 'API Tokens';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.API Tokens');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Admin';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Admin');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 95;
|
||||
|
||||
|
||||
@@ -12,9 +12,15 @@ class Backup extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-archive-box-arrow-down';
|
||||
|
||||
protected static ?string $navigationLabel = 'Backup';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Backup');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Admin';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Admin');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 96;
|
||||
|
||||
|
||||
@@ -15,9 +15,15 @@ class CalendarBoard extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-calendar-days';
|
||||
|
||||
protected static ?string $navigationLabel = 'Calendar vizual';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Calendar vizual');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'CRM';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.CRM');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 8;
|
||||
|
||||
|
||||
@@ -15,9 +15,15 @@ class ExcelImportWizard extends Page
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-arrow-up-tray';
|
||||
|
||||
protected static ?string $navigationLabel = 'Import factură Excel';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Import factură Excel');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Stoc & Finanțe';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Stoc & Finanțe');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 65;
|
||||
|
||||
|
||||
@@ -14,9 +14,15 @@ class Finance extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-currency-dollar';
|
||||
|
||||
protected static ?string $navigationLabel = 'Finanțe (consolidat)';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Finanțe (consolidat)');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Finanțe';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Finanțe');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 49;
|
||||
|
||||
|
||||
@@ -10,9 +10,15 @@ class Integrations extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-puzzle-piece';
|
||||
|
||||
protected static ?string $navigationLabel = 'Integrări';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Integrări');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Marketing';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Marketing');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 63;
|
||||
|
||||
|
||||
@@ -16,9 +16,15 @@ class MechanicBoard extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-wrench';
|
||||
|
||||
protected static ?string $navigationLabel = 'Atelierul meu';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Atelierul meu');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Service';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Service');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 25;
|
||||
|
||||
|
||||
@@ -16,9 +16,15 @@ class MechanicKpi extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-chart-bar';
|
||||
|
||||
protected static ?string $navigationLabel = 'KPI mecanici';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.KPI mecanici');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Service';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Service');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 28;
|
||||
|
||||
|
||||
@@ -15,9 +15,15 @@ class PipelineBoard extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-funnel';
|
||||
|
||||
protected static ?string $navigationLabel = 'Pipeline';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Pipeline');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'CRM';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.CRM');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
|
||||
@@ -11,9 +11,15 @@ class Recommendations extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-light-bulb';
|
||||
|
||||
protected static ?string $navigationLabel = 'Recomandări';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Recomandări');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Analiză';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Analiză');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 72;
|
||||
|
||||
|
||||
@@ -18,9 +18,15 @@ class Reports extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-chart-bar';
|
||||
|
||||
protected static ?string $navigationLabel = 'Rapoarte';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Rapoarte');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Analiză';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Analiză');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 70;
|
||||
|
||||
|
||||
@@ -21,9 +21,15 @@ class Scanner extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-qr-code';
|
||||
|
||||
protected static ?string $navigationLabel = 'Scaner';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Scaner');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Depozit';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Depozit');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 39;
|
||||
|
||||
|
||||
@@ -15,9 +15,15 @@ class Settings extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-cog-6-tooth';
|
||||
|
||||
protected static ?string $navigationLabel = 'Setări';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Setări');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Admin';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Admin');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 90;
|
||||
|
||||
|
||||
@@ -11,9 +11,15 @@ class VinSearch extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-magnifying-glass';
|
||||
|
||||
protected static ?string $navigationLabel = 'VIN-căutare';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.VIN-căutare');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Depozit';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Depozit');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 41;
|
||||
|
||||
|
||||
@@ -11,9 +11,15 @@ class Workload extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-fire';
|
||||
|
||||
protected static ?string $navigationLabel = 'Încărcare STO';
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('nav.label.Încărcare STO');
|
||||
}
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Analiză';
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('nav.group.Analiză');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 73;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user