From 1377aa4f8df8b5cbf648a78f26e5aa07ce7126dc Mon Sep 17 00:00:00 2001 From: Ludy Date: Wed, 30 Apr 2025 10:30:15 +0200 Subject: [PATCH] Internationalize logout message (#3450) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description of Changes Please provide a summary of the changes, including: - **What was changed** - Controller now uses the `login.logoutMessage` i18n key instead of hard-coded text. - Added `login.logoutMessage` entry to `messages_de_DE.properties` and `messages_en_GB.properties`. - Updated `login.html` to resolve the logout message via `th:text="#{…}"`. - **Why the change was made** - To support localization for logout feedback. - To eliminate hard-coded strings from the view layer and rely on message bundles. before: ![image](https://github.com/user-attachments/assets/5e9975f6-717f-4035-8e3c-76df8c0275bb) after: ![image](https://github.com/user-attachments/assets/934f45ad-d490-4a34-9399-5c9031f2db2d) --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [x] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. --- .../software/SPDF/controller/web/AccountWebController.java | 2 +- src/main/resources/messages_de_DE.properties | 1 + src/main/resources/messages_en_GB.properties | 3 ++- src/main/resources/templates/login.html | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/web/AccountWebController.java b/src/main/java/stirling/software/SPDF/controller/web/AccountWebController.java index 3f478abe9..327cda76c 100644 --- a/src/main/java/stirling/software/SPDF/controller/web/AccountWebController.java +++ b/src/main/java/stirling/software/SPDF/controller/web/AccountWebController.java @@ -191,7 +191,7 @@ public class AccountWebController { } if (request.getParameter("logout") != null) { - model.addAttribute("logoutMessage", "You have been logged out."); + model.addAttribute("logoutMessage", "login.logoutMessage"); } return "login"; diff --git a/src/main/resources/messages_de_DE.properties b/src/main/resources/messages_de_DE.properties index 039eaed56..d9b1022f4 100644 --- a/src/main/resources/messages_de_DE.properties +++ b/src/main/resources/messages_de_DE.properties @@ -607,6 +607,7 @@ login.userIsDisabled=Benutzer ist deaktiviert, die Anmeldung ist mit diesem Benu login.alreadyLoggedIn=Sie sind bereits an login.alreadyLoggedIn2=Geräten angemeldet. Bitte melden Sie sich dort ab und versuchen es dann erneut. login.toManySessions=Sie haben zu viele aktive Sitzungen +login.logoutMessage=Sie wurden erfolgreich abgemeldet. #auto-redact autoRedact.title=Automatisch zensieren/schwärzen diff --git a/src/main/resources/messages_en_GB.properties b/src/main/resources/messages_en_GB.properties index a8be0c1b6..6b2935747 100644 --- a/src/main/resources/messages_en_GB.properties +++ b/src/main/resources/messages_en_GB.properties @@ -609,6 +609,7 @@ login.userIsDisabled=User is deactivated, login is currently blocked with this u login.alreadyLoggedIn=You are already logged in to login.alreadyLoggedIn2=devices. Please log out of the devices and try again. login.toManySessions=You have too many active sessions +login.logoutMessage=You have been logged out. #auto-redact autoRedact.title=Auto Redact @@ -1432,7 +1433,7 @@ cookieBanner.preferencesModal.description.2=Stirling PDF cannot—and will never cookieBanner.preferencesModal.description.3=Your privacy and trust are at the core of what we do. cookieBanner.preferencesModal.necessary.title.1=Strictly Necessary Cookies cookieBanner.preferencesModal.necessary.title.2=Always Enabled -cookieBanner.preferencesModal.necessary.description=These cookies are essential for the website to function properly. They enable core features like setting your privacy preferences, logging in, and filling out forms—which is why they can’t be turned off. +cookieBanner.preferencesModal.necessary.description=These cookies are essential for the website to function properly. They enable core features like setting your privacy preferences, logging in, and filling out forms—which is why they can’t be turned off. cookieBanner.preferencesModal.analytics.title=Analytics cookieBanner.preferencesModal.analytics.description=These cookies help us understand how our tools are being used, so we can focus on building the features our community values most. Rest assured—Stirling PDF cannot and will never track the content of the documents you work with. diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index a359b20e3..ae12e5210 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -112,7 +112,7 @@
OAuth2: Error Message
-
+
Default message if not found