Keep the chosen language across sign-in and forced sign-out
A language picked on a signed-out page is now stored on the account when the user signs in (StoreLocaleChosenBeforeLogin), so the app does not switch back to the account default. EnsureAccountIsUsable keeps the user's language for the login page when it ends a disabled account's session. ChangePreferredLocale runs in a transaction like the other use cases, the language names come from layout.languages instead of the Locale enum, and the translation test also compares fi.json with en.json and rejects English files without a Finnish counterpart. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -6,21 +6,11 @@ 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.
|
||||
* account; signed-out pages keep it in the session. Their names are the
|
||||
* translations layout.languages.<value>.
|
||||
*/
|
||||
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',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user