1

I am building a WP site using the Panoramica theme by CPOThemes, and so far most of it is working really well. However, not all translations work as they should (or at least not as I expect them to).

Specifically, I can't figure out why the header "Archives" on the main page isn't translated. The site can be found here for you to look at - "Archives" is on the lower right.

This is what I have, that I thought would work:

  • a file named /wp-content/languages/sv_SE.po (and .mo) that I have not changed, but I downloaded it and opened in poedit and the key "Archives" exists and is translated correctly.
  • The code line that outputs the Archives header in the theme (specifically in sidebar-home.php) looks like this:

    <h3 class="widget-title"><?php _e('Archives', 'cpotheme'); ?></h3>
    
  • At the top of my functions.php, I have the following line:

    <?php load_theme_textdomain('cpotheme'); ?>
    
  • Somewhere in wp-config.php, I have

    define('WPLANG', 'sv_SE');
    

Why doesn't this translate correctly?

1 Answer 1

0

To get 'Archives' translated in your text domain you have to load a theme translation .mo file. The file in /wp-content/languages/sv_SE.po will not be used for that.

  • Create a directory languages in your theme.
  • Add the translations for the theme to that directory. I recommend the Codestyling Localization plugin for that.
  • Load the theme translations with:

    load_theme_textdomain( 'cpotheme', get_template_directory() . '/languages' );
    

See also: List of Default Translated Phrases for a way to inspect the phrases for a given text domain.

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.