Skip Navigation

[Resolved] String translation does not work in a content template

This thread is resolved. Here is a description of the problem and solution.

Problem: Strings added using the wpml-string shortcode and translated in WPML String Translation do not appear translated on the front end.

Solution: This is a bug in WPML 3.7.0 where the string is being given the text domain of wpml-shortcode rather than that of the context attribute provided in the wpml-string shortcode, and will be fixed in an upcoming WPML release

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by Kirill 3 years, 4 months ago.

Assigned support staff: Nigel.


I'm trying to use a wpml-string shortcode within a content template. However, for whatever reason this does not work (it seems to worked before on the other site, but not now). Here is what I've done:

1. Created a new content template named 'Test Content Template'.

2. Added a text wrapped in wmpl-string shortcode to it:

[wpml-string context='toolset_template']Проверка[/wpml-string] (Text is in Russian).

3. Translated a string to English in WPML String Translation. First I've changed string original language to Russian (for whatever reason it was set to English) and added an English translation, 'Test'. Marked translation as complete.

4. Inserted a content template into a page in Russian (Russian is set as the main language of the site):

[wpv-post-body view_template="test-content-template"]

5. Copied the same code as above into an English translation of a page.

What I expect is that English translation of a page would display 'Test' instead of 'Проверка', but both are showing the Russian text version.

Here are the links:
Russian version: hidden link
English version: hidden link
As you see, text below page title is the same, even though text string is shown as translated ('Translation Complete').

Am I using it the right way? What should I fix to make it work?

I can provide you with access to the WP Admin of the site if necessary.

Thank you in advance!

Best regards,



Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Kirill

I'm testing this on a local site and I'm experiencing the same problem.

Let me do a little more digging and I will get back to you.



Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Kirill

It seems you have indeed stumbled across a bug.

I have escalated this thread and it will be investigated further by second tier who will hopefully identify a solution.

I'll update you when there is something to report.


Hi Nigel!

Great that you was able to reproduce it. Hope it would be reasonably easy to fix.

It also seems that this bug is affecting only some strings, presumably newly added ones. Probably it has something to do with translation tables not updated properly when a new string is added, but this is a very wide guess.

This problem is affecting a production site, so if there will be a solution, please let me know. I can patch toolset code manually while waiting for the bug fix release. It will allow to deploy a fix faster.

Thank you for your support!

Best regards,



Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Kirill

This is a WPML issue which is being worked on (and will be fixed in WPML), but in the meantime I have a workaround for you.

Although the shortcode allows you to specify the context (i.e. the text domain) for your strings, this domain is not being respected and the string is also being registered against the text domain "wpml-shortcode".

So in WPML > String Translation, look for your string with the wpml-shortcode text domain and translate that. Then it should be rendered correctly when output using the wpml-string shortcode.

(To future proof when this is fixed, you may want to translate the string both for your chosen text domain, and the wpml-shortcode domain.)


Thank you very much Nigel!

Now I understand what was going on. I see now that all strings are duplicated, and that is causing a problem.

The workaround you offered works, thanks. Hope guys in WPML will be able to release a patch soon.

Thank you very much for your great support!

Best regards,