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]>
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
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
|
|
{
|
|
public function findById(int $id): ?UserAccount;
|
|
|
|
public function findByEmail(EmailAddress $email): ?UserAccount;
|
|
|
|
/**
|
|
* Inserts a new user or updates a stored one, and returns the stored
|
|
* user (a new one gets its id here).
|
|
*/
|
|
public function save(UserAccount $user): UserAccount;
|
|
|
|
public function isEmailTaken(EmailAddress $email, ?int $exceptUserId = null): bool;
|
|
|
|
/**
|
|
* Counts active admins other than the given user. Locks the active
|
|
* admin rows until the transaction ends, so two concurrent changes
|
|
* cannot both remove "the other" admin.
|
|
*/
|
|
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;
|
|
}
|