Theme and Plugins Translation
Last updated
Last updated
VERSION 3 Translation guide.
WE RECOMMEND OUR USERS TO USE LOCO TRANSLATOR FOR TRANSLATING THE THEME AND PLUGINS : https://wordpress.org/plugins/loco-translate/
1. Go to WP Admin -> Plugins -> Add New 2. Search for plugin “Loco Translate”
3. Install and Activate the plugin. 4. After Activation locate WP Admin -> Loco Translate
5. Click on Loco Translate.
6. Choose the plugin/theme which provides the text that you want to translate.
7. Click on that plugin/theme. Some settings will appear.
8. Now click on edit template.
9. After clicking on EDIT TEMPLATE , Now a page will open. Click on sync and save to syncronise the pot file.
10. Now go back to wp-admin->loco translator->plugins->select that plugin.
11. Now click on COPY on the language that you want to edit that is provided by us with the plugin.
12. Some Settings will appear.
13. Now choose the exact language that you selected in the previous step.
Choose system language and copy translations from XX.
Click on start translating, it will create a copy of the translation file in the global folder.
14. Click on sync and save.
15. Now you can simply add your translation strings and then save them.
All that translation that you make in this global file will retain even after updaing the theme and the plugin.
16. Now go back to that wp-admin->loco translator->plugins->select that plugin again
Since you have created a global translation file, now you can delete the local translation file.
DONE.
*********************************************************************************************
WPLMS highly recommends using LOCO Translator for translation.1. Go to WP Admin -> Plugins -> Add New 2. Search for plugin “Loco Translate”3. Install and Activate the plugin. 4. After Activation locate WP Admin -> Loco Translate
5. Click on Loco Translate.
6. Choose the plugin/theme which provides the text that you want to translate.
7. Click on that plugin/theme. Some settings will appear.
8. Now click on edit template if template is already created.
Otherwise you will have to create a template.
OR
10. Now Select the language translation file or create a new language translation file.
11. Click on new language to add the language. Some settings will appear.
12. Choose your language and always select the system location
13. Click on start Translating.
14. Now a whole new set of settings will appear.
15. Click on the Sync button.
16. Search for the text that you want to translate.
17. select the text.
18. Write the translation text then click on save.
19. You can download the PO and MO files from here.
20. If you are translating any string with Variables like %s, %d
Then You need to follow this guide.
https://developer.wordpress.org/themes/functionality/internationalization/#variables
FINALLY CHECK THE FRONTEND TO SEE YOUR TRANSLATED TEXT. #CHEERS.
If you want to add your own po/mo files or your custom translation then it is strongly advised that you put set the location as GLOBAL.
PO and MO Global translation files Location
For Themes : “wp-content\languages\themes\”
For plugins : “wp-content\languages\plugins\”
It is advised so because after each update we replace the po/mo files located in the local folders. So if you have added any translation of your own it will get replaced.
Also the priority of translation files is :
1. Global 2. Local
So always choose Global for your own custom translations.
That way your custom translation will be retained even after the update.
GUIDE TO SAFELY BACKUP TRANSLATION FILES BEFORE UPDATING
1. Make a backup of all the po/mo files located in the local folders of your plugins and theme.
PO and MO local translation files Location
For Themes : “wp-content\themes\wplms\languages”
For plugins : “wp-content\plugins\pluginname\languages”
PO and MO Global translation files Location
For Themes : “wp-content\languages\themes”
For plugins : “wp-content\languages\plugins”
The Global translation files are not changed when you update any plugin or theme.
Only Local Translation files are changed.
2. You can Also Download the po and mo files of one by one.
Go to wp-admin->loco translator->choose the theme or plugin->choose the language.
Now You can download the po/mo files of that plugin/theme
AFTER UPDATING PLUGIN/THEME
Some strings maybe added, removed or changed after the update.
1. Go to wp-admin
2.. Click on Loco Translate.
3. Choose the plugin/theme which provides the text that you want to translate.
4. Click on that plugin/theme. Some settings will appear.
5.. Now click on edit template
6. After clicking on EDIT TEMPLATE , Now a page will open. Click on sync and save to syncronise the pot file.
7. Now go back to the wp-admin-> loco translator->the plugin or theme you want to translate.
8. Now Select the language translation file
9. Click on the Sync button.
10. Click on save.
YOUR POT FILE, PO FILE AND THE MO FILES ARE SYNCHRONISED WITH THE SOURCE CODE.
1. WordPress changed the way how it manages the translation files in 4.6 Update. Prior to 4.6 version of wordpress style of naming the translation files was “xx_XX.po/mo” but now they have changed it to “text_domain-xx_XX.po/mo”. So, we also had to change the way how we do it in our theme update “WPLMS 2.3″to make it compatible with wordpress 4.6 and up.
Please note the Code Styling won’t work for wordpress 4.6 and above.
You can Download This plugin from here: https://wordpress.org/plugins/loco-translate/
2. If you are translating any string with Variables like %s, %d, Then You need to follow this guide.
https://developer.wordpress.org/themes/functionality/internationalization/#variables
3. Location Priority of translation files in our themes.
I. Global Folder : Our theme loads the Translation files located in the global folder.
System : wp-content/languages/plugins/’textdomain’-xx_XX.po
System : wp-content/languages/themes/’textdomain’-xx_XX.po
II. Local Folder : Our theme loads the Translation files located in the local foder.
Author : wp-content/themes/themename/languages/’textdomain’-xx_XX.po mo
Author : wp-content/plugins/pluginname/languages/’textdomain’-xx_XX.po mo
4. If translation Still Doesn’t work Then try doing this :
VIA FTP
Theme translation file location
Move the vibe-xx_XX.po/mo located in the “../wp-content/themes/wplms/languages/” folder to “../wp-content/languages/themes” folder.
Plugin translation file location
Move the ‘abcd’-xx_XX.po/mo located in the “../wp-content/plugins/’pluginname’/languages/” folder to “../wp-content/languages/plugins” folder.
9. After clicking on EDIT TEMPLATE , Now a page will open. Click on sync and save to syncronise the pot file.