From f15b78174bd5479cb8c89934eab3c466db8e0084 Mon Sep 17 00:00:00 2001 From: Aotumuri Date: Sat, 12 Jul 2025 00:40:29 +0900 Subject: [PATCH] Internationalization: Add i18n support for login/auth messages in main (#1406) ## Description: Internationalized all authentication-related messages shown before login or when unauthorized (e.g. "Login is required to access this website.") using the `translateText` function. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: aotumuri --- resources/lang/en.json | 6 ++++++ src/client/Main.ts | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/resources/lang/en.json b/resources/lang/en.json index debc8de8e..fbf709405 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -572,5 +572,11 @@ "grogu_head": "Grogu Head", "grogu": "Grogu" } + }, + "auth": { + "login_required": "Login is required to access this website.", + "redirecting": "You are being redirected...", + "not_authorized": "You are not authorized to access this website.", + "contact_admin": "If you believe you are seeing this message in error, please contact the website administrator." } } diff --git a/src/client/Main.ts b/src/client/Main.ts index 3f6b7ccd4..196f3186f 100644 --- a/src/client/Main.ts +++ b/src/client/Main.ts @@ -27,7 +27,11 @@ import { TerritoryPatternsModal } from "./TerritoryPatternsModal"; import { UserSettingModal } from "./UserSettingModal"; import "./UsernameInput"; import { UsernameInput } from "./UsernameInput"; -import { generateCryptoRandomUUID, incrementGamesPlayed } from "./Utils"; +import { + generateCryptoRandomUUID, + incrementGamesPlayed, + translateText, +} from "./Utils"; import "./components/NewsButton"; import { NewsButton } from "./components/NewsButton"; import "./components/baseComponents/Button"; @@ -229,8 +233,8 @@ class Client { text-align: center; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); "> -

Login is required to access this website.

-

You are being redirected...

+

${translateText("auth.login_required")}

+

${translateText("auth.redirecting")}

-

You are not authorized to access this website.

-

If you believe you are seeing this message in error, please contact the website administrator.

+

${translateText("auth.not_authorized")}

+

${translateText("auth.contact_admin")}