Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a site that needs to be billingual, English and French. I've created two sites in WPMU, and set the language settings of the second to fr_FR. Under the directory:

/wp-content/languages/

I have fr_FR.po and fr_FR.mo files for the Wordpress backend translations, and it is working well. I've also created a theme called "oak" that is used by both the English and French site, with a folder called "languages". In the folder I have fr_FR.po and fr_FR.mo files with translations for all of the text in the theme (properly formatted).

The french site is not loading the translations from those files, and I'm not sure why.

All text on the site that needs to be translated is wrapped in

__('text', 'oak'); 

or

_e('text', 'oak');

Where 'oak' is the name of the theme folder.

The .po and .mo files are properly formatted, generated using poedit. Is there something I am missing to get the translations on the french site to work?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Have you added the Function load_theme_textdomain to the theme? so if you have them themes .mo files in theme/mytheme/languages

Loads the theme's translated strings:

add_action('after_setup_theme', 'my_theme_setup');
function my_theme_setup(){
    load_theme_textdomain('my_theme', get_template_directory() . '/languages');
}

Put this in your functions.php

share|improve this answer
    
This fixed the issue, thanks so much! I had the load_theme_textdomain being called directly in the functions.php instead of using an action. –  Dave Hunt Jun 8 '12 at 10:17
    
Sweet! And it's always good to print strings in view of future multilanguage support. Even if it's not a requirement yet. –  Pontus Abrahamsson Jun 8 '12 at 10:21
    
Pontus, what do you mean by "print strings in view of future multilanguage support"? –  brasofilo Jun 8 '12 at 16:27
    
A mean, if you gona echo strings out in plain html like <p>i'm a string</p> its always a best-practice to add the translatable string like: <?php _e('i'm a string','mytheme'); ?> –  Pontus Abrahamsson Jun 8 '12 at 16:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.