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:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Modules\Users\Presentation\Http\Controllers;
|
||||
|
||||
use App\Modules\Users\Presentation\Http\Middleware\SetLocale;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -10,10 +11,15 @@ class LogoutController
|
||||
{
|
||||
public function __invoke(Request $request): RedirectResponse
|
||||
{
|
||||
$locale = app()->getLocale();
|
||||
|
||||
Auth::guard('web')->logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
// The login page stays in the language the user had chosen.
|
||||
$request->session()->put(SetLocale::SESSION_KEY, $locale);
|
||||
|
||||
return redirect()->route('login')->with('status', __('auth.logged_out'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user