Translate your Planet 4: strings (commands), theme and plugins.
📚 Manage Planet 4 > Administration > Translations
What are strings?
A lot of the strings (site commands) used in themes and plugins appear in the frontend.
These are texts like: “Results for”, “search”, “sort by”, “most relevant”, “refine your search”, that will have to be translated in case your site is not in English.
Key Information
- There is no functionality in WordPress to have different languages in backend and front-end. However, if a web editor wants to see the backend in a different language than the frontend, it should hover over the name of the user in the top right corner, then select “Edit my profile”, and then select Language > English and click the Update profile button.
- Do not leave fields empty while you are translating. This will help you identify easier what is new and needs translating as new versions of the themes/plugins come out.
- If the translated strings (Language translation in LOCO plugin) won’t reflect on frontend of site, then check the “Default locale” value at “WPML >> Languages >> Edit languages”. It should match the language “Locale code” in LOCO transaction plugin.
Should your office prefer to have some strings in English (because for example those strings are in the backend and they don’t want them translated), here’s a workaround:
a) Translate all the strings you want in the desired language (see the process below)
b) Copy the English texts in the rest.
Translate a P4 theme strings using Loco
1) Go to https://planet4.greenpeace.org/wp-admin/
- A P4 admin must have created your login, see Roles & Permissions
2) Login with Google
3) On the left side, go to Loco Translate -> Themes (yes! A WP plugin does that!)
4) Click on “Greenpeace Planet 4 Master Theme”
5) IF YOUR LANGUAGE DOES NOT EXIST ALREADY (if it exists, go to step 7 )
a) Move the mouse pointer over English (UK) text and click on ‘Copy’ on the links that will appear under ‘English (UK)’.
Note: DO NOT click on ‘New language’. By creating a new language you won’t be able to separate frontend-backend strings.
b) From the menu “WordPress language”, select the language you want.
c) Very important: Select the location “Author” / 4th option
d) Leave the default settings for ‘Template options’ and click “Start translating”
6) Ok, now you have created a template for your language for frontend strings. If you need to translate also the backend strings you need to do again step 5) (all it’s substeps) but you need to ‘copy’ English (UK) template from Planet4 Master Theme backend section. Then you follow the same substeps from step 5)
7) If you just created your language, or if you language existed, click on your language. Note that there are four sections there, two for frontend strings (theme & blocks) and two for backend strings.
8) Click on ‘Sync’ to synchronise your language’s template file, with the master template file in order to get the latest translatable strings.
If the sync was successful, you will see a message stating that xxx number of strings were added/removed (if you language file was not up to date).
9) Select the text you want to translate, and translate it (or just put the command in English if you want some parts to be in English! See the Key Info above)
Some strings like “%d result” have multi-string translation (singular & plural) , in this case please ensure you also update the both singular and plural translations of string.
10) Repeat until you have translated everything you wanted
11) Click the save button.
Update language template files
From time to time and as the product evolves we add (or remove) new strings to the themes and the plugins.
To get these strings in your language file please follow step 8 in “Translate a P4 theme strings using Loco”.
The same procedure applies for the plugins also.
Video Tutorial
Links and Resources
Loco Translate – Plugin official site