ultimatemember / Extended

All custom extended features and codes
16 stars 14 forks source link

Password Strength Estimator Translation #67

Closed Prehniumpartner closed 7 months ago

Prehniumpartner commented 8 months ago

Hey :)

i would like to translate the password strength estimator extension in another language (german) but there is no PO File to even start the translation. I could "hardcode" the translation intothe php files but i would prefer to not do it in case of an update.

dorxy commented 7 months ago

I also noticed that the change password tab in account is currently not working. The javascript assumes an identifier um_field_password_user_password while the container actually has an identifier um_field_0_user_password in my installation.

Perhaps the default zxcvbn translations can be done by replacing the used library with zxcvbn-ts which has language packs. Then only the strength var translation remains to be moved to PO files. For more flexibility, the entire language pack could also be in PO file since you can pass translations in options on creation.

champsupertramp commented 7 months ago

Hi @dorxy - Yes, I saw the new repo for zxcvbn a couple of days ago and planning to implement it so we can translate those strings. I'll check the issue with the change password tab in the account form.

champsupertramp commented 7 months ago

Hi @dorxy @Prehniumpartner - Could you please try the pre-release version that has added enhancements with the translations? https://github.com/ultimatemember/Extended/releases

Please let me know if you're encountering issues.

Kindest Regards,

dorxy commented 7 months ago

Thanks for taking this up so quick!

I've installed the prerelease and the issue with the password change form has been resolved.

Translating the zxcvbn strings has also been successful, yet it does not work with the Loco translate plugin that is suggested on the translation documentation, since it assumes it should be in a um-extended domain while it's not. Manually placing the po and mo files in wp-content/languages/plugins worked like a charm.

The only thing that I could not get to work was the translations in the JS itself, like the 'Worst ☹' string. I'm thinking there might be a wp_set_script_translations necessary but playing around with it by adding it to Core::enqueue_assets I could not get it working. Perhaps I'm not looking in the right place, I'm thinking you can do this way faster ;)

To test with, I've added the dutch translation files I'm working with. um-pass-strength-nl_NL.zip

Prehniumpartner commented 7 months ago

thank you for the quick implementation!

I can confirm that the only problem that still exists are the JS strings

#: assets/js/um-pass-strength.js:14524 resources/js/app.js:19
msgid "Worst ☹"
msgstr "Very bad ☹"

#: assets/js/um-pass-strength.js:14525 resources/js/app.js:20
msgid "Bad ☹"
msgstr "Bad ☹"

#: assets/js/um-pass-strength.js:14526 resources/js/app.js:21
msgid "Weak ☹"
msgstr "Weak ☹"

#: assets/js/um-pass-strength.js:14527 resources/js/app.js:22
msgid "Good ☺"
msgstr "Good ☺"

#: assets/js/um-pass-strength.js:14528 resources/js/app.js:23
msgid "Strong 💪"
msgstr "Strong 💪"

#: assets/js/um-pass-strength.js:14566 resources/js/app.js:70
msgid "Strength"
msgstr "Strength"

Otherwise everything works perfectly. Attached is the German translation in "Du" form um-pass-strength-de_DE.zip

champsupertramp commented 7 months ago

Hi @Prehniumpartner @dorxy - Please try the updated pre-release version: https://github.com/ultimatemember/Extended/releases

It has fixed the missing string translations. Let me know if you're still encountering issues.

Kindest Regards,

dorxy commented 7 months ago

I can confirm with the latest pre release 2.0.5-rc7-flow the script translations are also working! 👍