feat: locale

This commit is contained in:
2026-05-21 21:32:20 +02:00
parent 19e65e36f3
commit 8e5a50dd2b
21 changed files with 337 additions and 32 deletions
@@ -35,6 +35,11 @@ class UserForm
->required()
->unique(ignoreRecord: true)
->maxLength(255),
Select::make('locale')
->label(__('admin.users.fields.locale'))
->options(self::localeOptions())
->default('en')
->required(),
FileUpload::make('avatar_url')
->label(__('admin.users.fields.avatar'))
->image()
@@ -136,4 +141,18 @@ class UserForm
]),
]);
}
/**
* @return array<string, string>
*/
private static function localeOptions(): array
{
$labels = __('admin.users.locales');
return collect(config('app.supported_locales', ['fr', 'en']))
->mapWithKeys(fn (string $locale): array => [
$locale => is_array($labels) ? ($labels[$locale] ?? $locale) : $locale,
])
->all();
}
}