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 made my theme ready for translation. My text domain is my_theme and my .po and .mo (de_DE.po and de_DE.mo) files are located in a subfolder languages in my themes folder.

In my functions.php I added the following code:

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

My backend language is "German" but the translation isn’t loaded. Any ideas?

share|improve this question

1 Answer 1

load_theme_textdomain() returns TRUE on success and FALSE if no file was found. For debugging try the following change:

function my_theme_setup(){
    $path = get_template_directory() . '/languages';
    $result = load_theme_textdomain('my_theme', $path );

    if ( $result )
        return;

   $locale = apply_filters( 'theme_locale', get_locale(), 'my_theme' );
   die( "Could not find $path/$locale.mo." );
}
share|improve this answer

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.