Troubleshooting String Localization
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 it’s set to translate with WPML.
If you’ve chosen to either translate with a .mo file or not translate at all. It’s not going to work.
Then, make sure that all languages have their locale set correctly. This is crucial so that any existing translations that come from .mo files from other places (like your many 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) Texts in widgets needs to 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 ) {
extract($args);
$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.
Hi
I looked on your site to try to find some support email address to email,couldn;t
i wanted to post on your forum, but on your forum for the life of me i could find no button saying “create new post” !
I like this plugin, but, if I cant get bits working I will have to ask for the refund, which would be a shame.
anyway, i have theme widgets, i have checked the code and its wrapped in apply_filters:
$title = apply_filters(‘widget_title’, $instance['title'] );
$content = apply_filters(‘widget_content’, $instance['content'] );
now doing a scan using your plugin for strings finders the TITLE but, does not find the widget_content. I have rescanned and rescanned and rescanned, yet it never finds it
Help, please! thanks
Darren
In the forum, you need to choose which subject you’re posting about. This sounds like technical, so you should go here:
http://forum.wpml.org/forum.php?id=1
Then, once logged in, there’s certainly a ‘new topic’ box, at the bottom of the page.
I am trying to get String Localization to work. I want to translate via gettext, but if I go to “WPML->Theme and plugin localization” and choose “Translate with WPML”, it always switches back to “Translate with .mo-Files”. It is not possible to save this option. Whats wrong with it? Did i forget to prepare or do something important before?
I am using last Version of WPML and WP 3.42
There can be several causes for this. First, you should make sure that the String Translation plugin is actually installed in your site. Then, check for JS errors. To get proper help, please report in our technical forum. Explain what versions you’re using and what you’re seeing. The support folks might need access to your site to see what you’re seeing.
Hello,
I have 4 languages on my website. The standard language is English, while the admin language is Dutch. Next to that I added French & German.
Everything goes fine, except for the string translation from the theme: the system finds a lot (186 strings) but when I want to translate these, I only get English, French & German… No Dutch… I can see the result of my translation actions in the website too, but for Dutch it is still in English…
Please help me on this one, because my project is almost ready to deliver…
Best Belgian regards,
Jurgen
It’s really difficult to tell what’s happening without more information. Please start a new thread about it in our forum, give a link to your site and upload screenshots that show what you are referring to. This will help our support staff tell what’s wrong.