Theme Localization
WPML allows localizing themes in two ways:
- The traditional .mo files (good for when you already got that with the theme).
- Translate the theme’s texts directly from WPML
This is the theme localization menu, found in WPML->Theme localization.
Providing translation for the theme texts
Option 1: Translating the theme from within WPML
When WPML localization is selected (the 2nd option in the image above), WPML will scan the theme and find the texts that can be translated. It reports what it finds and let you enter translations, right from within WordPress.
Click on Scan the theme for strings and WPML will go through all the files in the active theme and get translatable texts from them (texts that are wrapped with gettext functions).
It shows how many strings were found in the theme and their translation status. To translate them, click on View strings that need translation. This will take you to the String translation page, where you can enter translation for each of the texts found in the theme.
* Don’t stop here, next you need to set the locale for each language.
Option 2: Using a .mo file for theme localization
Many WordPress themes already come with translations to different languages. When this is available, you can use the translation that’s already provided instead of translating yourself.
To use translation from a .mo file, choose the first option from the theme localization menu. The only thing that you need to specify is the text-domain for your theme.
When the theme was created, the texts were wrapped in gettext calls. Each call includes two arguments – the string that needs to be translated and a second argument called the text-domain. This second argument identifies all the texts in the theme as belonging to it. You need to enter this value in the text domain field, so that WPML can load the translation file and assign it to the theme.
Specifying the locales for different languages
A locale is a code which determines which language variant to use for different languages. In order for theme localization to work correctly, you need to tell WPML which locale value to use for different languages.
The following table lists locale values for popular languages:
| Language (links to the WordPress localization) | Locale | Country |
|---|---|---|
| German | de_DE | Germany |
| Spanish | es_ES | Spain |
| Dutch | nl | Netherlands |
| Danish | da_DK | Danish |
| French | fr_FR | France |
| Italian | it_IT | Italy |
| Brazilian Portuguese | pt_BR | Brazil |
| European Portuguese | pt_PT | Portugal |
| Russian | ru_RU | Russia |
| Traditional Chinese | zh_CN | China |
| Simplified Chinese | zh_HK | Hong Kong |
| Japanese | ja | Japan |
* There are many other .mo files available through the WordPress localization project.
To enable localization for your language, you need to do two things:
- Set the language locale file in the Locale file name column.
- Download the WordPress locale file and save it to wp-includes/languages. The download links are provided in the table above (click on the language name).




English
简体中文
Deutsch
日本語
Español
Thx for the plugin!!! It’s been really useful!!
I think you should have a link to this post. It makes much more sense about text domain and text wrapping. It took me some time to figure that out.
By the way, simplified Chinese is used in China, and traditional Chinese is used in Hong Kong and Taiwan. You got it another way round.
Yes, this sounds amazing…
just a quick question:
What is the concept for multiligual support of plugins?
Thanks
Markus
Right now, WPML doesn’t localize plugins (yet), so you still need to use the .mo files for that. We’re planning to add this soon, but I can’t give an exact date.
There’s no voice like “WPML->Theme localization” in the plugin menu
Click on ‘Advanced’ at the right-top of the WPML configuration page. Then, the menu will include this as well.
is there any way to shose a theme for a selected language? for exemple if defaut language > use the EN-theme if arabic then use the AR-theme ( where ( AR-theme is the name of the wordpress theme )?? any idea?
Im using the Hybrid Theme Framework, anyone know how I can find out the “TextDomain”?
thank you
Hi!
I have a problem- WPML finds only 2 strings to translate, although the theme files consists a lot more to be translated.
How to fix that?
All the texts in the theme need to be wrapped in gettext cals and have a textdomain argument (that’s the 2nd argument in the call).
If you’ve done that and it’s still not working, use the forum for support.
Now I have found about 60 but those are not the strings that i was expecting to be.
http://www.lexusfoorum.net/web5/
For example that “Feature video” is generated from the text (which I can change) from sidebar.php file but WPML does not but that to the list.
The other thing is that do I really need mo files for every language? I mean- what do they includes? WordPress default strings I guess?
Hi,
I try to translate the “Homepage Box # ” on my homapge, but they still don’t appear on the string ?
How can I get an access to these box?
Thanks
Ivan
Thanks for the plugin!!!
I currently have a dynamic website in the following setup.
http://www.example.com/en
http://www.example.com/es
http://www.example.com/fr
I want to install a blog like
http://www.example.com/en/blog for English,
http://www.example.com/es/blog for Spanish, and
http://www.example.com/fr/blog for french
What is the best way to accomplish this in the plugin.
I don’t think that you can achieve this with WPML.
You can get example.com/blog/es/, but not the other way around.
I’ve installed a theme that use lot of options stored in database. How can I translate these options ?
Hold on for WPML 1.7.3. It will include an interface for translating admin texts. As always, we’ll be announcing it in our blog.
Hello!
WPML is very nice! Thank you for this plugin. But I need some help. When Im changing language of a page, it translating, but I cant see another pages. only Home page. Maybe because of my theme? it is Basic theme designed by ElegantTheme and even when Im adding page on my native language I need to set up in theme options to show this new page on the site. But when Im adding translation of this page I cant see it in the Theme options.
Thank u for help
Hi,
Im dealing with the same problem..I’ve to select the pages for nav menu from my themes options panel. But it displays only the default language pages. Is there a way to fix this..
Thanks a lot..
Hi, I just wanted to know how could I translate words in php files with this plugin, is that possible? Example in my site (http://justfm.lt) im my header.php i done navigation.
If you wrap the texts in the code in gettext calls, WPML will let you translate them.
amir, help me please.
When Im changing language of a page, it translating, but I cant see another pages. only Home page. Maybe because of my theme? it is Basic theme designed by ElegantTheme and even when Im adding page on my native language I need to set up in theme options to show this new page on the site. But when Im adding translation of this page I cant see it in the Theme options.
I have an English theme and it tries to translate not to polish, but to English… What could be wrong? I’m using P2 theme.
I think I have the same (or similar) problem as above…
My blog default language is Portuguese (PT) and then I have English (EN) as secondary. On the theme’s root folder of the theme I’m using, there’s a folder named “languages”, which has .mo/.po files for PT language (but there isn’t one for EN). However, the PT translation is not complete, there’s about 18 strings missing in the .mo/.po file and I find easier to just translate this on the WP admin instead of messing with the files.
But there’s a problem… When I translate the missing strings with WPML, they are actually being replaced on the EN language and not on the PT one. The PT one will actually use the default EN strings instead of using the PT ones I just translated using WPML.
How can I fix this issue?
I’ve got exactly the same problem: WMPL uses default language configured at its options as default language for gettext calls, and it wouldn’t be the same (as templates are usually in English by default).
How can I translate links in my sidebar or some text in vidjets?
One text that is wrapped with gettext is not being displayed for translation.
How should it be wrapped for WPML to find it?
Right now it’s:
Thanks,
Gabriel
I think this is the future of Multi language Plugin! Thank you for this great job!
Just two questions.
1. I use a theme that includes a slider for post. In my default language (IT) everything works properly, but when I use the footer switcher, the slider disappears.
I got this both in [http://example.com/ - Italiano, http://example.com/en/ - Inglese, etc.] and in [http://example/?lang=en] configuration.
2. Dropdown menu in header bar doesn’t work and shows just the mother page, and not the sons.
I think these two problem are generated by the same cause, but I don’t know what!
Any idea of solution?
Thank you in advance,
Luca
We’re going to be ready with the next version of WPML early next week. Let’s see if it works after that change.
Then, if not, we might be able to check this for you as a paid service. Let me know if so, and I’ll connect you with some very capable support folks.
Thanks! I hope it will work!
Luca
Thank you for the great plugin, i was thinking for quite a while if i should use qTranslate or WPML and decided to use WPML for future projects, because it can translate really all strings, seams to be more professional, faster and has better SEO and content seperation.
Though there are some things that I miss:
- WPML can not automatically detect the users language, at least in my test that did not work (using always default language on the home page)
- it is not possible just tu display posts which is not translated in their original language with an note that it was not translated automatically (which a also liked with qTranslate)
- i had a german theme, which i prepared for localization, but i can not change the default theme language in WPML, it is always en-US and i can not point to an en-US.mo language file to use
Maybe I am just to stupid to handle it, but maybe it is also something you could fix in future versions?
I installed the WPML plugin on a site, it works great, thank you!
I would like to translate some words from an english menu (from the theme) to another language. But as these words are just plain html in the theme, they are not automatically translateable. I would need to make them strings.
As I read here, I need a “gettext” system, with which i would insert text strings via php in the theme. These text strings would be then recognisable by the WPML plugin and the plugin would be able to change these strings for each languages.
But, my problem is, I cannot find a good gettext explanation, for people who do not use php. Would you be so kind and give us a simple example here?
Thanks a lot!
Horia
Gettext:
In the meantime I found the answer myself, and I post here a simple example, If anyone needs it:
instead of a text like: “Main Menu” like this:
Main Menu
you insert this:
(where “your theme” is the name of the theme that is used, if the case)
this makes WPML able to find the string “Main Menu” and to ask you then for translating it in another language of your WPML enabled site.
more details here, a great blog post about it:
http://blog-en.icanlocalize.com/installing-wordpress-for-multiple-language-blogs/how-to-localize-wordpress-themes-and-plugins-with-gettext/
Gettext:
this is the same answer again, hoping that the code will show this time!
In the meantime I found the answer myself, and I post here a simple example, If anyone needs it:
instead of a text like: “Main Menu” like this:
Main Menuyou insert this:
(where “your theme” is the name of the theme that is used, if the case)
this makes WPML able to find the string “Main Menu” and to ask you then for translating it in another language of your WPML enabled site.
more details here, a great blog post about it:
http://blog-en.icanlocalize.com/installing-wordpress-for-multiple-language-blogs/how-to-localize-wordpress-themes-and-plugins-with-gettext/
Gettext:
this is the same answer again, hoping that the code will show this time!
In the meantime I found the answer myself, and I post here a simple example, If anyone needs it:
instead of a text like: “Main Menu” like this:
<h2 class=”menuheader”>Main Menu</h2>
you insert this:
<h2 class=”menuheader”><?php _e(‘Main Menu’, ‘your theme’); ?></h2>
(where “your theme” is the name of the theme that is used, if the case)
this makes WPML able to find the string “Main Menu” and to ask you then for translating it in another language of your WPML enabled site.
more details here, a great blog post about it:
http://blog-en.icanlocalize.com/installing-wordpress-for-multiple-language-blogs/how-to-localize-wordpress-themes-and-plugins-with-gettext/