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 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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

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.