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:

Simple Content Template
<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:

Single house page displayed with a Content Template - English (the site primary language).
Single house page displayed with a Content Template – English (the site primary language).

Single house page displayed with a Content Template - Spanish. The content displays in the proper language except for the field labels.
Single house page displayed with a Content Template – Spanish. The content displays in the proper language except for the field labels.

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:

Content Template with 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.

Strings wrapped in the wpml-string shortcodes appear the in WPML String Translation panel.
Strings wrapped in the wpml-string shortcodes appear the in WPML String Translation panel.

When we visit the front-end houses, we will see everything translated, including the labels.

Single house page in Spanish with field labels translated.
Single house page in Spanish with field labels translated.

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.

Inserting a translatable string using "Fields and Views" button
Inserting a translatable string using “Fields and Views” button

Selecting the context of the string to translate
Selecting the context of the string to translate

Please note that you will see this Translatable string button only if you have the WPML String Translation plugin activated.

Creating different Content Templates for different languages

First, go to the Toolset -> Settings page and click the WPML integration tab. There, enable the Create different Content Templates for each language option.

Enabling the Create different Content Templates for each language option
Enabling 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.

Setting a language for translation of content template
Setting a language for translation of content template

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.

Edit existing translation
Edit existing translation

Translating Toolset templates designed using page builders

If you use a page builder to design your Content Templates you have to translate your templates.

Need help?

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.