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
@@ -6,6 +6,7 @@ namespace App\Modules\Users\Domain\Contracts;
use App\Modules\Shared\Domain\ValueObjects\EmailAddress;
use App\Modules\Users\Domain\Entities\UserAccount;
use App\Modules\Users\Domain\Enums\Locale;
interface UserAccountRepository
{
@@ -29,4 +30,9 @@ interface UserAccountRepository
public function countActiveAdmins(?int $exceptUserId = null): int;
public function countActiveInternsSupervisedBy(int $supervisorId): int;
/**
* Stores the user's language of the user interface.
*/
public function changeLocale(int $userId, Locale $locale): void;
}
+26
View File
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Modules\Users\Domain\Enums;
/**
* The languages of the user interface. A user's choice is kept on their
* account; signed-out pages keep it in the session.
*/
enum Locale: string
{
case Finnish = 'fi';
case English = 'en';
/**
* The language's name in the language itself, as language pickers show it.
*/
public function nativeName(): string
{
return match ($this) {
self::Finnish => 'Suomi',
self::English => 'English',
};
}
}