Add English to the UI and a profile menu for language and theme

Every UI string now exists in lang/fi and lang/en; a unit test checks that
both languages have the same keys and placeholders. A user's language is
stored on the account (users.locale) and applied by the SetLocale web
middleware, falling back to the session's choice on signed-out pages and
then APP_LOCALE. Emails use the user's language through
HasLocalePreference, and the login page keeps the language after logout.

The header's name, theme toggle and logout button become one profile menu
(a disclosure) with the language buttons, light/dark/system theme radios
kept on the device, and logging out. Signed-out pages get a Suomi/English
switch next to the theme toggle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-25 06:28:39 +02:00
co-authored by Claude Opus 5.5
parent c2265256c3
commit 8aead06972
40 changed files with 2197 additions and 44 deletions
@@ -0,0 +1,31 @@
{{--
Language choice on the signed-out pages (login, forgot and set password). It is kept in the session; once
signed in, the account's own language is used. The current language is marked with aria-pressed and a check
icon, not colour alone.
--}}
<form method="POST" action="{{ route('locale.update') }}">
@csrf
<fieldset class="flex items-center gap-1">
<legend class="sr-only">{{ __('layout.profile.language') }}</legend>
@foreach (\App\Modules\Users\Domain\Enums\Locale::cases() as $locale)
@php($isCurrent = $locale->value === app()->getLocale())
<button
type="submit"
name="locale"
value="{{ $locale->value }}"
lang="{{ $locale->value }}"
aria-pressed="{{ $isCurrent ? 'true' : 'false' }}"
@class([
'flex min-h-6 items-center gap-1 rounded-md px-2 py-1 text-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-700 dark:focus-visible:outline-blue-400',
'font-semibold text-zinc-900 underline decoration-2 underline-offset-4 dark:text-white' => $isCurrent,
'text-zinc-700 hover:bg-zinc-200 dark:text-zinc-200 dark:hover:bg-zinc-700' => ! $isCurrent,
])
>
@if ($isCurrent)
<x-icon name="check" class="size-4" aria-hidden="true" />
@endif
{{ $locale->nativeName() }}
</button>
@endforeach
</fieldset>
</form>