What are strings?
A lot of the strings (site commands) used in themes and plugins appear in the front end.
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.
|
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
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.
Translate Engaging Networks form strings
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 -> Click on “Planet4 – EngagingNetworks”
4) if your language does not exist add a new and keep the Author field as default (3rd option) and hit “Start Translating”
Follow steps 6 to 10 from ‘Translate a P4 theme strings using Loco’ section above.
Translate P4 plugins using Loco
You will need to do a similar procedure also for the plugin “Planet4 Blocks” (and in the future for any additional plugins we create).
For plugins is not required to copy an already existing template (like we did with master-theme).
1) Select the plugin you want to translate (for example ‘Planet4-Blocks’).
2) Create a new language, if your language does not already exist.
3) Select you language in option ‘1. Choose a language’. Choose ‘Author’ location as in the below example.
Then click on ‘Start translating’
Great! You have created a new template for planet4-blocks frontend strings. If you need also to translate backend strings you should redo steps 2) and 3) by creating a new language template in ‘Planet4 blocks plugin backend’ section.
Now you are ready to start translating the strings to your language.
Follow steps 7 to 10 from ‘Translate a P4 theme strings using Loco’ section if you need to know how you can translate the strings.
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
These instructions in a video
Links & Resources
- Loco Translate – Plugin official site