Forcing translated field names when using translation files with WP-Members™

WP-Members™ stores all of its registration field names and some of the user dialogs in the WordPress database.  If you are installing localized translation files for WP-Members™ on a WordPress installation where you have already activated the WP-Members™ plugin, you will likely find that the translated fields names do not load into the database. 

The plugin, once installed, does not reinstall any database settings.  This is so the plugin installation process not inadvertently overwrite any custom settings that may have been set.

In order to override this and get the translated field names into the database, there is a toggle in the wp-members-install.php file. Follow these steps to make the change and load the translated field names:

  1. In the WordPress Admin Area, go to the Appearance > Editor menu.
  2. In the Editor Panel, look in the upper right of the screen for “Select plugin to edit” and select WP-Members.
  3. Below that, look in the list of Plugin Files for wp-members-install.php.
  4. Near the top of the very first function in this file, wpmem_do_install, look for $chk_force = false; Change this to $chk_force = true;
  5. Save the change by clicking “Update File”
  6. Go to the WP Plugin panel and deactivate/reactivate the plugin.

The field names should now be translated.  I would suggest changing the toggle back to false,  but it isn’t totally necessary.  Also, if you had previously customized any of the plugin’s settings, you may need to double-check your settings.

Comments

  1. Euclides says

    Hello, thank you for this excellent open source plugin and for your time.

    I am trying to add a spanish version of th eplugin, I do have the .po file and I do understand this post explanaiton, however, I dont know where to upload the spanish .po file… I am assuming that it should be in the plugin file called “lang” . I did this but nothing has changed, do I need to overwrite the “wp-members.pot” file?

    Thank you in advanced!

    • Chad says

      Euclides – you need to upload the .mo file. The .po file is the file you would edit, the .mo is the compiled machine code file that the system needs to translate.

  2. Michael says

    Wouldn’t it be better, to always keep the english fields names in the database and translate them when rendering the HTML?

    For example, changing the line

    $wpmem_themsg = sprintf(__(‘Sorry, %s is a required field.’, ‘wp-members’), $wpmem_fields_rev[$row][1]);

    into

    $wpmem_themsg = sprintf(__(‘Sorry, %s is a required field.’, ‘wp-members’), __($wpmem_fields_rev[$row][1]));

    Or is there any problem with this approach?

  3. Amir says

    This is not working even for me (I changed $chk_force to true, deactivated and activated), it loads the same english fields. I tried to change from the db manually the values but it wasn’t a good idea.
    I uploaded the .mo in /wp-content/plugins/wp-members/lang and then even in wp-content/languages

    Any solutions?

    • Chad says

      Is the .mo file named appropriately (for example, in Spanish, they should be wp-members-es_ES.mo)?
      Is the rest of the site translated in the same language and working in that language?

        • dan says

          Amir, thanks. I was going crazy trying to figure out why the steps given didn’t work.

          For anyone else having the same problem, I deactivated the “Admin in English” plugin, then followed the steps given by Chad above, reset the flag to “false” (just to be safe), and then reactivated the “Admin in English” plugin and everything seems to work great.

  4. AhmidBalaze says

    I just can´t find the wp-members-install.php file from the plugins list. I´ve just found wp-eMember/eMember_installer.php wich seems to me to be incorrect.

    I really need to change the language registration fields to spanish for my latino customers.

    I´m not much into php so I get lost easily

    Thanks in advance

  5. Rob says

    It didn’t work for me either. What’s strange is that everything is translated (even the fields) apart from “Existing User Login” and “New User? Click here to register”. Also, I just looked into Dialogs in Wp-Members Options and two last fields out of the lot aren’t translated:

    “Password successfully reset!An email containing a new password has been sent to the email address on file for your account. You may change this random password then re-login with your new password.”
    and

    Can you help?
    “Put your TOS (Terms of Service) text here. You can use HTML markup.”

    • Chad says

      Not all of the translations have updated all translatable strings. If something isn’t translated, it is possible that it was added since that translation was done. All of the translations include bot the .po (the template file) and the .mo (the machine readable translation). You can edit the .po file using something like Poedit (poedit.net) to create a new .mo file.

  6. mavus says

    Hi!! Thanks a lot for this excellent plugin!! In my case I found out that my problem with wp-members translation is qtranslate plugin. Once I’ve updated .mo and .po files and following those steps, I tried deactivating plugins and It seems like qtranslate override my login and registration translation and set the default. I use qtranslate because I need a multilanguage site, any suggestion? Thanks a lot in advance!!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>