How to debug failed load_theme_textdomain()?

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." );
}

Leave a Comment