This guide will walk you through adding your own translations to a theme or a plugin that has already been set up for translation. Changing in the original files is not a good idea, because after updating theme or plugins you will lose all your translations. In wplms, we are using Loco Translate Plugin which is really easy to use and easy to setup as well. It’s a free plugin and you can read more about this plugin in the docs.
There are 3 important things after setting up Loco Translate Plugin
MO files: MO, or Machine Object is a binary data file that contains object data referenced by a program. It is typically used to translate program code, and may be loaded or imported into the GNU gettext program.
PO files: PO files are the files which contain the actual translations. Each language will have its own PO file, for example, for French there would be a fr.po file, for german there would be a de.po, for American English there might be en-US.po.
POT file: POT files are the template files for PO files. They will have all the translation strings left empty. A POT file is essentially an empty PO file without the translations, with just the original strings.
Steps
Please follow the steps below for translation
- First Step, is to check your site language and for that Go to wp-admin > Settings > General Settings > Site Language
- After Activating Loco Translate Plugin, Click on Loco Translate Plugin and Choose the plugin/theme which provides the text that you want to translate.
- Click on that plugin/theme. Some settings will appear.
- Now, this is an important step. Your site Language decides in which language you have to add translations. For Example: your site language is English(US) and you want to translate text into the German Language. Then Choose the English Language here and add strings translation in the German Language.
Selecting site language to add translation
- In any case, you will not find your site Language here, then you have to click on New Language and Select your language. This will create a new po and mo file in your language.
- In the above step, I mentioned Global Language Folder and Local language Folder so what it is and which Location we have to choose while creating a PO and MO file of our own Language
- 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 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.
Translating The String
- Now, you have your Language PO File, Click on Edit. Now a whole new set of settings will appear.
- Click on the Sync button. This will sync all the strings of the newly created PO File with your POT file. Search for the text that you want to translate.
- select the text. Write the translation text then click on save.
- If you are translating any string with Variables like %s, %dThen You need to follow this guide.https://developer.wordpress.org/themes/functionality/internationalization/#variables
- Now check the Frontend, you will see your translated text.
Backup Translation Files Before Updating
You can perform this step by inbuilt Loco Translate Plugin Feature. In any case, you saved the translation in Local Language File So what you have to do is, click on copy
- Now start Translating and your translations copied to Global language Folder. No need to translate again.
Translations Still Not working
It might be possible that you have all the translations saved in the Global Language Folder. Still, the language Folder is not loading in Frontend due to which your translations not visible in frontend. So create a copy of your translations, as instructed in above section
And, create a copy of translations in your Local Language Folder as well.
Translating Profile Menu
You don’t need Loco Translate Plugin to translate this text. Simply Go to Appearance > Menus > and change the navigation label
Translating Members Area
Translating Buddypress Navigation
WPML WPLMS Compatibility
Yes, now the WPML Plugin is compatible with v4. You can check this video tutorial. This is a multilingual plugin so you can create multilingual site with the help of this plugin.
This is a paid plugin and not a part of WPLMS product or not included in the package. There are the package according to users so you can choose from these packages and use that. For more information, do visit WPML site
WPLMS plugin version 1.5.1 and Vibebp 1.5.0.3 required.
For translation Queries, create Ticket here: https://wplms.io/support/forums/forum/support-queries/translation-issues/