This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 11 replies, has 2 voices.

Last updated by Pieter 10 years, 3 months ago.

Author Posts
June 24, 2009 at 7:58 pm #10797

Pieter

I was hoping that with the latest release, my problems would be solved.
Alas, they are not...
As it turns out now, it seems that the items in for example the sidebar will get translated only according to the default language of the website.
The translations of Posts and Pages work perfect with your plugin, but the rest does not.
If you now have a look at my site (hidden link) you will see that it is the main domain with the English language. However, the headers of the sidebar are all in Dutch, because the default language is Dutch.
When the default language is English, everything is in English also if you go to other languages. Obviously this cannot be the purpose of your plugin, so I would like to ask whether anyone knows a solution for this?
Thanks!
PS I actually noticed that on your very own site (http://www.wpml.org), the sidebar also remains in English at any and every language, so maybe I just want too much?
Now that I see this, it basically means that I have 3 options:
1. get rid of the plugin and have all different WP-installs
2. wait for WP Hive to add multilinguality
3. get rid of my category headers and hope that the visitors of the site can figure it out with non-navigation...

June 24, 2009 at 9:27 pm #10799

Amir

WPML currently doesn't translate widget titles (hence the untranslated word 'News' in our own site).
We're planning to add this and will start working on it pretty soon. We were hoping to be there already but other issues pushed their way first.
For now, the solution is quite simple. Instead of using widgets, place static text in the sidebar and wrap it in gettext calls. Then, localize using your theme's .mo file.
It's quite easy actually. You can do the same as the widget, but by inserting the PHP to the sidebar. Then, wrap the heading in

<?php _e(); ?>

and you're done.

June 24, 2009 at 9:37 pm #10800

Pieter

Hi Amir, Thanks for your reply.
However: I don't use widgets.
And I have translated everything with gettext calls.
So this then basically means that the plugin doesn't work or that I am doing something terribly wrong.
Any chance that you can take a look?

June 24, 2009 at 10:16 pm #10801

Amir

Yes, we can look at it. The plugin does set the locale, and the .mo files should be loaded and used.
So, all these should be localized with gettext, you supplied the .mo files, set the locales and nothing happens?
Have a look at the 'theme localization' screen shot at the end of this post:
http://wpml.org/2009/05/wordpress-theme-localization/
Did you enter the locale names and does the plugin confirm that the .mo files are there?

June 24, 2009 at 10:31 pm #10802

Pieter

Yes, I have done all that and the plugin confirms existence of the files.
Not "nothing" happens. The plugin perfectly translates all content of Posts and Pages.
The things that are not translated are the headers in the sidebar, the title and description in the header and all content of the footer.
For purposes of making this (the problems I am experiencing) clear I have made the WP-language Dutch and the WPML default language English. The link to the site is in my first post.

June 25, 2009 at 12:27 am #10803

Pieter

would it be useful to send you the content of the troubleshooting area?
wp_en_icl_content_status and wp_en_icl_core_status are empty, should they be empty?

June 25, 2009 at 12:38 am #10804

Amir

The texts in the sidebar are not going to be in WPML's tables.
Let me explain what it does right now:
1) Per language it displays the right posts and pages. Each post/page is written in its own language. You have that working.
2) It sets the locale (according to what you've entered in the theme localization panel).
That's it. Nothing else gets translated right now by WPML. Any text in the theme that is wrapped by a gettext call (

__()

or

_e()

) will be localized by the .mo file which you included in the theme. Providing that you follow the instructions for using gettext. This includes the theme text domain and setting the correct name for each .mo file (according to the locale).
When I view your site, I can't tell which text is wrapped in gettext calls, so it's impossible to tell what should have been localized and what not.
The post I wrote about <a href="http://wpml.org/2009/05/wordpress-theme-localization/">theme localization</a> gives several examples from our own theme.
As you can see, it works just fine in our own site. Everything appears in the right language EXCEPT the word 'news' in the sidebar. This is a heading generated by a widget and is currently not localized. Not by gettext and not by WPML. WPML will be able to handle this in the future.
If you explain a bit what you've done in the theme and provide some code examples, I'll be able to understand much better.

June 25, 2009 at 7:08 am #10805

Pieter

Ah ok, thanks for your extended explanation. So probably I have to find my problem in the mo file translations. I did follow your "tutorial" to the letter, will give you some examples:
in the very top of my header.php I have included the line:

<? php load_theme_textdomain('blue-sky'); ?>

(Blue Sky is the theme I use)
then further down in the header I have included this line:

<h2><? php _e('Personalised books for Children','blue-sky'); ?></h2>

in the sidebar the different headers look like:

<h3><?php _e('Languages','blue-sky'); ?></h3>

and in the footer it looks all like:

<a href = " <? php echo get_option('home'); ?>/<? php _e('terms','blue-sky'); ?>/"><? php _e('Terms & Conditions','blue-sky'); ?></a>

(inserted additional spacing to make code visible)
Then I have run all files through PO Edit and autosaved as MO file. The Dutch language MO file is called nl_NL.mo and the Spanish file is called es_ES.mo; I uploaded those to the theme directory and I uploaded the WordPress mo files to the wp-content/languages/ directory.
Hope this info helps, please let me know if you need more info.

June 25, 2009 at 12:56 pm #10806

Pieter

Basically the translations in the mo files are correct, because after all Dutch is now showing up.
The problem lies in the fact that there is no switch going on when the WP language is something else than the language the viewer chooses.

June 25, 2009 at 1:08 pm #10807

Pieter

HURRAY!!!
Don't know what exactly I did, but I finally got it all working!
Thanks a lot for all the support, ideas, tips and most of all Patience!

June 25, 2009 at 6:40 pm #10808

Amir

I'm very glad to hear that and see that your site runs truly multilingual now.
In the next minor release, we're adding a function that will help you create language dependent links in your theme. Your footer says:
Aanmelden | Algemene Voorwaarden | Mapa del sitio | Credits
All these links will be very easily adjusted to the correct language, including both their texts and where they link to.
Now, you're not going to forget to add it to the showcase section, right?
http://wpml.org/forums/forum.php?id=6
Many people ask for sample sites and its just embarrassing to have only two sites listed there.
You can add it now and say that real contents is coming. People love seeing what others our doing. Us too.
Feel free to talk about this site and yourself and link to your business site as well.
Amir

June 25, 2009 at 11:57 pm #10809

Pieter

Hi Amir,
Yes my intention indeed was to add it to your showcase, but once I had it finished. Since you already want it now, I will do just that 🙂
I know the Spanish translation (for example in the footer) is not up to par yet, that will soon be done...
Piet

The topic ‘[Closed] only translation of content, rest according to default language’ is closed to new replies.