Simple Membership Plugin › Forums › Simple Membership Plugin › Translate validation popup on register page
- This topic has 12 replies, 2 voices, and was last updated 5 years, 1 month ago by
Wen.
-
AuthorPosts
-
June 30, 2021 at 2:24 pm #22776
Wen
ParticipantIs it possible to translate the validation popups on the registration form? I see there is a javascript file with english text, jquery.validationEngine-en, can I copy this file, translate the texts and add it somewhere? How do I make sure the form is using this version?
I tried Loco translate but it seems these popup messages are only javascript and don’t use the WordPress translationsfiles.
Kind regards,
WenJuly 1, 2021 at 1:44 am #22782mbrsolution
ModeratorHi, can you type here the message you are trying to translate?
Thank you
July 2, 2021 at 7:26 am #22795Wen
ParticipantFor example these lines:
* This field is required
* Usernames can only contain: letters, numbers and .-_*@
* Minimum 4 characters requiredJuly 2, 2021 at 12:10 pm #22797mbrsolution
ModeratorHi, those lines can be translated using PoEdit
https://simple-membership-plugin.com/translate-simple-membership-plugin/Or you can use Loco translate plugin.
https://wordpress.org/plugins/loco-translate/
Let me know if the above helps you.
Thank you.
July 2, 2021 at 12:15 pm #22798Wen
ParticipantI already tried Loco Translate as I wrote in the first post but those lines are not in there. It looks like the validation plugin is not using the WordPress translation files, only a javascript file.
July 3, 2021 at 12:29 am #22799mbrsolution
ModeratorHi,
I already tried Loco Translate as I wrote in the first post but those lines are not in there. It looks like the validation plugin is not using the WordPress translation files, only a javascript file.
If that is the case, then you will have to use PoEdit to translate the po file located in /wp-content/languages/plugins/.
Let me know if the above helps you.
Thank you.
July 5, 2021 at 10:51 am #22803Wen
ParticipantI opened the PO file (simple-membership-nl_NL.po) and can confirm that the following lines are not there to translate:
$loc_data = array( 'ajaxUserCall' => array( 'url' => admin_url('admin-ajax.php'), 'alertTextLoad' => '* ' . SwpmUtils::_('Validating, please wait'), ), 'ajaxEmailCall' => array( 'url' => admin_url('admin-ajax.php'), 'alertTextLoad' => '* ' . SwpmUtils::_('Validating, please wait'), ), 'email' => array( 'alertText' => '* ' . SwpmUtils::_('Invalid email address'), ), 'required' => array( 'alertText' => '* ' . SwpmUtils::_('This field is required'), ), 'strongPass' => array( 'alertText' => '* ' . SwpmUtils::_('Password must contain at least:').'<br>'.SwpmUtils::_('- a digit').'<br>'.SwpmUtils::_('- an uppercase letter').'<br>'.SwpmUtils::_('- a lowercase letter'), ), 'SWPMUserName' => array( 'alertText' => '* ' . SwpmUtils::_('Invalid Username').'<br>'.SwpmUtils::_('Usernames can only contain: letters, numbers and .-_*@'), ), 'minSize' => array( 'alertText' => '* ' . SwpmUtils::_('Minimum '), 'alertText2' => SwpmUtils::_(' characters required'), ), 'noapostrophe' => array( 'alertText' => '* ' . SwpmUtils::_('Apostrophe character is not allowed'), ), );This peace of code is from the file class.simple-wp-membership.php, it loads the javascript validation code and here are some lines merged so they can be translated.
I have manually added a line to the PO file, compiled it to a MO and uploaded it and now it’s working! Shall I add all those lines and send you the PO version?
July 6, 2021 at 1:41 am #22804mbrsolution
ModeratorHi,
I opened the PO file (simple-membership-nl_NL.po) and can confirm that the following lines are not there to translate:
Just to confirm with you. Which po file did you open? The po file found in?
/wp-content/plugins/simple-membership/languagesOr in
/wp-content/languages/plugins/
The reason why I am asking is because I checked the Spanish po file in
/wp-content/plugins/simple-membership/languages. This file has all the strings you mentioned above available for translation.Thank you.
July 6, 2021 at 7:37 am #22807Wen
ParticipantIn /wp-content/plugins/simple-membership/languages
July 6, 2021 at 8:57 am #22808mbrsolution
ModeratorHi,
I opened simple-membership-nl_NL.po file in my local dev site and there are only 294 strings. This is wrong. There should be 607 strings in the po file.
Please carry out the following. Open the simple-membership-nl_NL.po file from the same folder you mentioned above using PoEdit. Then click on Translation -> Update from POT file. This process should add all the missing strings into your simple-membership-nl_NL.po file.
Let me know if the above helps you.
Thank you
July 6, 2021 at 10:19 am #22811Wen
ParticipantYes, that was it, now there are 610 lines (of which are 278 translated) and the lines I was missing are already translated. I’ve created a new MO file and uploaded it and now the validation texts are nicely translated!
Will you add this to a new update or do I have to put the MO file in /wp-content/languages/plugins/ to keep this version?
Thankyou!
July 6, 2021 at 10:32 am #22812mbrsolution
ModeratorHi, please follow these instructions. This will answer your question.
https://simple-membership-plugin.com/translate-simple-membership-plugin/
Kind regards.
July 6, 2021 at 10:41 am #22813Wen
ParticipantOke, i’ve send a message!
-
AuthorPosts
- You must be logged in to reply to this topic.