rollerworks / PasswordStrengthBundle

Symfony Password strength and blacklisting validator bundle
MIT License
142 stars 26 forks source link

Translations #110

Closed Ramyrus19 closed 2 years ago

Ramyrus19 commented 3 years ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

Hello ! I am using the password validator with Symfony 5.3 for a french website, but the translations are not fully functionning. The strength levels and the tips are not translated.

Le mot de passe doit avoir une force d'au moins "Strong", la force actuelle est "Very Weak", essayez ceci : add (upper/lowercase) letters, add special characters, add more characters. Le mot de passe doit contenir au moins une lettre. Le mot de passe doit contenir des majuscules et des minuscules.

In PasswordStrengthValidator.php, in the method validate(), if i dump $parameters, is looking like this :

PasswordStrengthValidator.php on line 119: array:4 [▼ "{{ length }}" => 8 "{{ min_strength }}" => "Strong" "{{ current_strength }}" => "Very Weak" "{{ strength_tips }}" => "add (upper/lowercase) letters, add special characters, add more characters" ]

I think that $this->translator->trans() is not working properly.

Can you please review this error ?

Regards, Ramona

sstok commented 3 years ago

We actually got a similar report (for the component), but that one was with a stand-alone.

I will try to investigate what's wrong.

sstok commented 3 years ago

Can you provide a small reproducer? https://symfony.com/doc/current/contributing/code/reproducer.html#reproducing-complex-bugs

I tried it locally (with Symfony 6.0-dev) and it's working as expected.

-message: "Wachtwoord moet ten minste aan veiligheidsniveau "Sterk" voldoen, maar het huidige niveau is "Zwak". Probeer het volgende: voeg hoofdletters toe, voeg nummers toe, voeg speciaal tekens of leestekens toe."
  -messageTemplate: "password_too_weak"
  -parameters: [▼
    "{{ length }}" => 6
    "{{ min_strength }}" => "Sterk"
    "{{ current_strength }}" => "Zwak"
    "{{ strength_tips }}" => "voeg hoofdletters toe, voeg nummers toe, voeg speciaal tekens of leestekens toe"

And I actually noticed just now there is a bug in the Dutch translation 🤦🏼

Ramyrus19 commented 3 years ago

Thank you for your answer.

I am pretty busy these days but i will make the reproducer as soon as possible.

Regards, Ramona

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.