Skip Navigation
Originally written
November 26, 2010
November 25, 2015

WPML’s String Translation mechanism allows to translate texts in the theme or plugins without having to go through .po and .mo files.

First, have a look at how to localize theme texts. If you entered translations, indicated that they’re complete and still seeing the original language in the site, check for one of these problems:

1) WPML Localization is set and language locale set

Go to WPML->Theme and plugin localization and make sure that “Translate the theme and plugins using WPML’s String Translation” is selected. This essentially turns the WPML String Translations plugin on.

If you’ve chosen the other option, “Don’t use String Translation to translate the theme and plugins” strings translated via WPML String Translations will not appear on the front-end of your site..

Then, make sure that all languages have their locale set correctly (consistent with the locale in the .mo files) . This is crucial so that any existing translations that come from .mo files from other places (like your plugins), still work.

2) TextDomain argument is set and its value correct

GetText calls look like this:

_e('Leave a reply','gogotheme');

In this example, the text for translation is ‘Leave a reply’. The second argument is called the text-domain. A text-domain says what the text belongs to.

A blank text-domain means that it belongs to WordPress core.

There are no reserved values for the text-domain. If you’re using an existing theme, find out what the theme’s text-domain is and keep using it. If you’re creating your own theme, just make up a text-domain and use it. Be consistent.

That text-domain argument needs to be a simple string. Not an expression and not a function. Just a string.

3) Titles in widgets go through ‘apply_filters’

If you’re writing your own code for widgets, make sure that the texts go through filters. WPML acts as a translation filter, so if filters are not applied, translations will not show.

For example, this is how the standard WP widgets work:

function widget( $args, $instance ) {
  $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance );
  $text = apply_filters( 'widget_text', $instance['text'], $instance );

As we can see, both the title and text go through filters.


*Developers please note: The ‘widget_text‘ filter appears to apply only for the WordPress default text widget. The codex documentation is a little ambiguous as to how this filter can be used by custom widgets. Until this is clarified you will want to register widget texts (other than the title) for translation using the WPML API functions for this.

4) Strings language is set to English and strings are registered in English

Detailed information on this can be found in the Using String Translation with Default Language Other Than English article.

In case you notice strings registered in any language other than English simply select them and delete them from the String Translation admin screen.