Mehrsprachigkeit der Oberfläche (Deutsch Standard, Englisch wählbar)
- Sprache je Benutzer (users.locale), Middleware SetLocale, Auswahl unter Einstellungen → Darstellung; angebotene Sprachen in config/app.php - Übersetzungen über Laravel Lang (lang/de.json, lang/de/*.php), Seitentitel aus #[Title] werden übersetzt - Eigene Texte und Korrekturen in lang/project/de.json, übernommen mit `artisan lang:apply-project` (überstehen `lang:update`) - Tests: jede im Code verwendete Übersetzung ist vorhanden, eigene Übersetzungen sind übernommen, Sprachwahl und Standardsprache; SecurityTest prüft Texte sprachunabhängig über __() - lang/ von Pint ausgenommen (erzeugte Dateien) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cdd2d5b676
commit
db2d5d6228
@@ -2,11 +2,36 @@
|
||||
|
||||
namespace App\Livewire\Settings;
|
||||
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Appearance settings')]
|
||||
class Appearance extends Component
|
||||
{
|
||||
//
|
||||
public string $locale = '';
|
||||
|
||||
/**
|
||||
* Mount the component.
|
||||
*/
|
||||
public function mount(): void
|
||||
{
|
||||
$this->locale = App::getLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the selected interface language and reload the page in that language.
|
||||
*/
|
||||
public function updatedLocale(): void
|
||||
{
|
||||
$this->validate([
|
||||
'locale' => ['required', 'string', Rule::in(array_keys(config('app.available_locales')))],
|
||||
]);
|
||||
|
||||
Auth::user()->update(['locale' => $this->locale]);
|
||||
|
||||
$this->redirectRoute('appearance.edit');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user