1

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?

0

1 Answer 1

2

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

4
  • 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
    Commented Jun 8, 2012 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. Commented Jun 8, 2012 at 10:21
  • Pontus, what do you mean by "print strings in view of future multilanguage support"?
    – brasofilo
    Commented Jun 8, 2012 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'); ?> Commented Jun 8, 2012 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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