[Plugin: WP-Members] How to translate to other languages
-
Hi
Is there any pot, po or mo file in orther to make easy the process of translating the plugin to other languages?
Thanks
-
The field names are stored in a db array at install. So… none of these will be translated “on-the-fly.” Also, simply deactivating/reactivating does not overwrite the settings. So, to have a properly translated installation, the translation needs to be there at install.
In the past, for simply customizing what the fields were, this involved uninstalling/deleting the plugin, then doing a clean install. Starting with 2.4, I added a toggle to force update these settings to make the process easier.
In wp-members-install.php, the first function is wpmem_do_install. At the top is a toggle $chk_force. (Note: a simple change like this can be done through the WP admin panel’s plugin editor.) Change that value to true, then deactivate/reactivate the plugin to force update all of the settings.
Caveat emptor: This will revert all installed settings back to the default settings, so double check your settings before and after. It will have no effect on user registrations, or any settings made to posts/pages, etc; just the options, fields, and dialogs done at install.
Hope that helps!
Wow! Thanks for reply so fast!
The solution worked very well.When you release the final version, tell me to send you the translation into Portuguese.
Hugs
DiegoI have made a Swedish translation. However, I think there is a small bug in the wp-members.php file when loading the translations.
The textdomain should just be the plugin-name and the relative path need to be passed in the third argument.
I changed this:
$wpmem_textdomain = ‘wp-members/lang’;
load_plugin_textdomain($wpmem_textdomain);into this (according to the documentation)
$wpmem_textdomain = ‘wp-members’;
load_plugin_textdomain($wpmem_textdomain, false, dirname( plugin_basename( __FILE__ ) ) . ‘/lang/’);now everything including the field names got translated properly into Swedish ??
/ Jan
Hello everyone!
I’m sorry if I seem quite dummy to not understand exactly how to make this translation function working… but I really can’t make it work, even if I tried 100 things for 2 hours!
Here’s the website I’m working on:
https://www.aquario-passion.com/members-area/I have the latest WP-Members version (2.5)
I added a .mo and a .po files in the LANG file of the WP_members plugin file (I’ve copied the fr_FR.mo and .po file from the LANG section of the wpress version installed, is it ok?)
I even doubled the fr_FR.po and fr_FR.mo file renaming the copies fr.mo and fr.po, just in case it was the title who wasn’t good.I copied and replace in the wp-members.php the code line that jhvass gave above.
Then… I don’t know what to do more, and it’s still not working…
I’m just a photographer helping my association making a little website, not a professionnal of computoring, so I’m sure I don’t understand the coding and computer language like you… But could you help me on this (with easily understandable advices, lol)?
Thanks a lot!
Sabinekactusficus – as far as I am aware, there is not a French translation of WP-Members. You can’t copy the .po/.mo language files for WordPress to the plugin – it needs translation files that are specifically for the plugin itself.
Are you up for doing a French translation?
Hi Cbutelrjr,
Yes, I’ll be happy to do my own trnaslation (and sharing with the community, is I can find out how to share files here)!
Can you tell me how to proceed?
cheers!
sabineSalam,
Excuse me, thank for the great plugin.
I’ve made translation in Indonesian from the copy .pot. Saving the file as wp-members-id_ID.po and wp-members-id_ID.mo files. Then put them on folder “wp-content/plugins/wp-members/lang/”But, to make change on data fields, like “address, zip, city, etc”, need some modification in wp-members-install.php. Each field label manually translated. (Sorry, is that right?)
I’ve made some relayouting the form. From table format to tableless format. Here’s the form I’ve made :
kactusficus – contact me via the contact page on my blog and we can dialog via email. I will get you the version 2.5 POT file you’ll need. If you then want to share the French translation, that would great – you can then send it to me and I’ll include it with the plugin.
cindelaras – if you have loaded the plugin at anytime before you added the translation, the field names are already loaded into the database. These need to be deleted in order for the translated field names to be loaded in. There are two ways to do this. (1) you can deactivate the plugin, then use the delete feature in the WP plugin admin. This runs the plugin’s delete feature which clears out the database settings. Or (2) there is a toggle in the wp-members-install.php file called $chk_force. There are instructions on using this commented into the file, but essentially, setting this to true will force the plugin deactivation/reactivation to reload all of the plugin’s db options (thereby providing you with translated field names). Just be sure to set this back to false when you are done, in case you deactivate the plugin later and don’t want to unintentionally override any custom settings.
thank u cbutlerjr,
I have did the 1st one. And now, the plugin is working very well. Can I share the plugins with a bit modification for Indonesian?@cindelaras – I’m not sure I understand your question… are you talking about a modified version of the plugin? If so, you can as long as attribution is given. But it’s not recommended to do so, as this creates a branch that will not necessarily be compatible with future upgrades. If you are talking about the .po/.mo files – no problem.
I′m sorry but i′m totally lost here. How do i translate the plugin, do i put both .mo and .po files in the lang directory and that′s it? i′ve put es_ES.po and es_ES.mo but nothing happens.
Please help, i′m totally lost here!. Thanks.
Can you clarify…
Is the site also set up in spanish? I would assume so otherwise why would you be asking about translating the plugin, but I have to ask to make sure.
Are these translation file for the plugin? Again, it sounds like you know what you are doing with translation, but a user did ask me once before and it turned out he was putting WP translation files in the folder, not translation of the plugin, so again, sorry, but I have to ask.
Are they named wp-members-es_ES? I’m guessing this might be the issue. The translation files need to have the plugin name as the prefix, so if not, they should be wp-members-es_ES.mo and wp-members-es_ES.po
Hope that helps. Let me know.
Yeah, in spanish. Yes, they are for the plugin, i put them in the lang folder inside the plugin.
Ok i′ll name it that way, maybe that works. If i name it that way it should work right away? or do i have to change some code in the php?.
Thanks a lot!!!.
The plugin uses the WP function
load_plugin_textdomain
to load the localized files so you shouldn’t need to make any other changes. As long as the .mo file has the plugin name prefix and matches the language being used by WP, you should be good to go.If you’ve already installed the plugin, though, you will need to follow the instructions I outlined above:
if you have loaded the plugin at anytime before you added the translation, the field names are already loaded into the database. These need to be deleted in order for the translated field names to be loaded in. There are two ways to do this. (1) you can deactivate the plugin, then use the delete feature in the WP plugin admin. This runs the plugin’s delete feature which clears out the database settings. Or (2) there is a toggle in the wp-members-install.php file called $chk_force. There are instructions on using this commented into the file, but essentially, setting this to true will force the plugin deactivation/reactivation to reload all of the plugin’s db options (thereby providing you with translated field names). Just be sure to set this back to false when you are done, in case you deactivate the plugin later and don’t want to unintentionally override any custom settings.
Thanks dude, that was it. I managed to do it by opening the .pot file in Poedit and then saving it as wp-members-es_ES.po and it worked.
Thanks a lot your plugin is very good!.
- The topic ‘[Plugin: WP-Members] How to translate to other languages’ is closed to new replies.