Views, Content Templates, and Toolset forms are Toolset elements that provide important features for your layouts. They include HTML, text, and fields. You need to translate all of the “hard coded” texts that appear in them.
A simple Content Template can look like this:
<h2>[wpv-post-title]</h2> [wpv-post-body] <div class="house-size">Size: [types field="size"][/types]</div> <div class="house-area">Area: [types field="area"][/types]</div>
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:
<h2>[wpv-post-title]</h2> [wpv-post-body] <div class="house-size">[wpml-string context="wpv-views"]Size:[/wpml-string] [types field="size"][/types]</div> <div class="house-area">[wpml-string context="wpv-views"]Area:[/wpml-string] [types field="size"][/types]</div>
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, Content Templates, and Toolset forms all 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 and in Toolset form.
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, Views, and Toolset forms, and we’ll do our best to help.
For more elaborate questions, please use our Toolset Professional Support forum.