Skip to content

feat: Added a translation key for “Password is too weak#6614

Merged
CommanderStorm merged 13 commits intolouislam:masterfrom
cyril59310:fix-6609
Jan 6, 2026
Merged

feat: Added a translation key for “Password is too weak#6614
CommanderStorm merged 13 commits intolouislam:masterfrom
cyril59310:fix-6609

Conversation

@cyril59310
Copy link
Copy Markdown
Contributor

ℹ️ To keep reviews fast and effective, please make sure you’ve read our pull request guidelines

📝 Summary of changes done and why they are done

  • Added a translation key for “Password is too weak

📋 Related issues

📄 Checklist

Please follow this checklist to avoid unnecessary back and forth (click to expand)
  • ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
  • 🧠 I have disclosed any use of LLMs/AI in this contribution and reviewed all generated content.
    I understand that I am responsible for and able to explain every line of code I submit.
  • 🔍 My code adheres to the style guidelines of this project.
  • ⚠️ My changes generate no new warnings.
  • 🛠️ I have reviewed and tested my code.
  • 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
  • 🤖 I added or updated automated tests where appropriate.
  • 📄 Documentation updates are included (if applicable).
  • 🔒 I have considered potential security impacts and mitigated risks.
  • [] 🧰 Dependency updates are listed and explained.

📷 Screenshots or Visual Changes

  • UI Modifications: Highlight any changes made to the user interface.
  • Before & After: Include screenshots or comparisons (if applicable).
Event Before After
UP Before After
DOWN Before After
Certificate-expiry Before After
Testing Before After

@cyril59310
Copy link
Copy Markdown
Contributor Author

I’ve just realized that many other keys were also missing for other features. I’ll work on adding them and open a new PR once this one is ready

server/server.js Outdated
Comment on lines +676 to +678
let err = new Error("passwordTooWeak");
err.msgi18n = true;
throw err;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this fixes the specific problem, I don't think it is a good fix.
Lets fix this more properly - How about:

  • we change it like this

    Suggested change
    let err = new Error("passwordTooWeak");
    err.msgi18n = true;
    throw err;
    throw new TranslatableError("passwordTooWeak");
  • add a small class for this

  • change the following test to also have a regex for this:

@CommanderStorm
Copy link
Copy Markdown
Collaborator

I’ve just realized that many other keys were also missing for other features

Yea, more of a structural problem

@CommanderStorm CommanderStorm added the pr:please address review comments this PR needs a bit more work to be mergable label Jan 6, 2026
@CommanderStorm CommanderStorm marked this pull request as draft January 6, 2026 19:26
Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lays some nice ground work to build on 👍🏻

@CommanderStorm CommanderStorm removed the pr:please address review comments this PR needs a bit more work to be mergable label Jan 6, 2026
@cyril59310
Copy link
Copy Markdown
Contributor Author

  • A screenshot of a failing test when a translation key is missing
image

@CommanderStorm
Copy link
Copy Markdown
Collaborator

I would have trusted you on that one 😉
Can I merge it, or do you want to add more of the TranslationErrors?

@cyril59310
Copy link
Copy Markdown
Contributor Author

cyril59310 commented Jan 6, 2026

I would have trusted you on that one 😉
Can I merge it, or do you want to add more of the TranslationErrors?

You can merge this; I’ll work on a new PR to add the missing translation keys 😉

@CommanderStorm CommanderStorm marked this pull request as ready for review January 6, 2026 20:34
Copilot AI review requested due to automatic review settings January 6, 2026 20:34
@CommanderStorm CommanderStorm changed the title Added a translation key for “Password is too weak feat: Added a translation key for “Password is too weak Jan 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds internationalization support for the "Password is too weak" error message by introducing a new TranslatableError class for backend error messages. The changes enable proper translation of password validation errors on both the initial setup and password change flows.

  • Introduced a new TranslatableError class for backend errors with translation support
  • Added the passwordTooWeak translation key to en.json
  • Updated password validation in both setup and change password flows to use translatable errors
  • Extended the translation test to validate TranslatableError usage in server-side code

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
server/translatable-error.js New error class that wraps translation keys and marks errors as translatable via msgi18n flag
src/lang/en.json Added passwordTooWeak translation key with the password requirements message
server/server.js Replaced hardcoded error strings with TranslatableError in setup and change password handlers, added msgi18n flag to error callbacks
test/backend-test/check-translations.test.js Extended test to scan server directory and detect TranslatableError usage, ensuring all translation keys exist

@CommanderStorm CommanderStorm enabled auto-merge (squash) January 6, 2026 20:41
@CommanderStorm CommanderStorm merged commit fc832d0 into louislam:master Jan 6, 2026
23 checks passed
@cyril59310 cyril59310 deleted the fix-6609 branch January 6, 2026 21:00
@CommanderStorm CommanderStorm added this to the 2.1.0 milestone Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error messages like "password to weak" are not currently translatable

3 participants