Views, Content Templates, and WordPress Archives are Toolset elements that provide important features for your layouts. They include HTML, text, and fields. You need to translate all of the “hardcoded” texts that appear in them.
A simple Content Template can look like this:
When you look at a house, displayed with this Content Template on the front-end, you will see these:
As you can see, everything looks right except for the field labels (size and area). This is because the labels are coming from our template and are not fields belonging to the content.
To translate them, we need to wrap the texts in wpml-string shortcodes.
Here is the same Content Template, after we’ve wrapped all texts in [wpml-string] shortcodes:
Now, you will find these new strings in WPML’s String Translation, where you can translate them.
When we visit the front-end houses, we will see everything translated, including the labels.
Views and Content Templates rely on the [wpml-string] shortcodes to translate their texts. If you are familiar with PHP templates, this is Toolset’s counterpart for GetText functions.
See some examples how to use the wpml-string shortcode in a View.
Instead of wrapping your strings manually with wpml-string shortcodes, you can use the Views GUI. Click the Fields and Views button and then Translatable string. A dialog box will open with a drop-down menu to select between all available contexts.
Please note that you will see this Translatable string button only if you have the WPML String Translation plugin activated.
First, go to the Toolset -> Settings page and click the WPML integration tab. There, enable the Create different Content Templates for each language option.
Now, when you to go to the Toolset -> Content Templates page, you can click a plus sign for a specific language to which you want to translate a content template into.
Depending on your Translation Management settings a translation editor will open up or you will be able to send a content template to your translators.
If you need to make any changes to existing translations, use the pencil icon for the language that you need to edit.
If you use a page builder to design your Content Templates you have to translate your templates.
Ask us about translating Content Templates, WordPress Archives, and Views, and we’ll do our best to help.
For more elaborate questions, please use our Toolset Professional Support forum.