feat: Added a translation key for “Password is too weak#6614
feat: Added a translation key for “Password is too weak#6614CommanderStorm merged 13 commits intolouislam:masterfrom
Conversation
|
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
| let err = new Error("passwordTooWeak"); | ||
| err.msgi18n = true; | ||
| throw err; |
There was a problem hiding this comment.
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 changelet 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:
Yea, more of a structural problem |
CommanderStorm
left a comment
There was a problem hiding this comment.
Lays some nice ground work to build on 👍🏻
|
I would have trusted you on that one 😉 |
You can merge this; I’ll work on a new PR to add the missing translation keys 😉 |
There was a problem hiding this comment.
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
TranslatableErrorclass for backend errors with translation support - Added the
passwordTooWeaktranslation key toen.json - Updated password validation in both setup and change password flows to use translatable errors
- Extended the translation test to validate
TranslatableErrorusage 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 |

ℹ️ 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
📋 Related issues
📄 Checklist
Please follow this checklist to avoid unnecessary back and forth (click to expand)
I understand that I am responsible for and able to explain every line of code I submit.
📷 Screenshots or Visual Changes
UPDOWN