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.

If I have WordPress installation in English, then I can define my theme translation file in the wp-config.php file with following:

define('WPLANG', 'sv_SE');

But if I have WordPress installed in the local language then there is already WordPress translation file defined there, then how can I define my theme translation file?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

It all depends a bit if your current theme already supports localization.

Does your theme's function file contain something like this?

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

If not, add it in there. And change twentytwelve to your theme-directory-name.

After that create a directory called languages in the root of your theme a drop your localization file (theme-directory-name-sv_SE.mo) in there.

share|improve this answer
    
Theme is translatable and I have no problem using the translation file with the WordPress which is installed in the English language. But if I have WordPress installed in local language, then it where I can define in the wp-config file because theres already WPLANG defined as I said above. –  xio Feb 28 '13 at 11:00
    
You don't have to. If your theme supports localization, you have the theme's .mo file in the theme's languages folder, and your wp-config.php file contains define('WPLANG', 'sv_SE'); you're done. (or you can start translating) –  Cor van Noorloos Feb 28 '13 at 11:05
    
oh I got it. Thank you very much. –  xio Feb 28 '13 at 11:06
    
Cool, thanks for the followup. Good luck! –  Cor van Noorloos Feb 28 '13 at 11:06
add comment

If you add the following line to your functions.php file:

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

The language files for your themes will be loaded from that directory (in this case the languages directory in your themes' folder.
In this folder you can put your sv_SE.po file (or another extension if you wish to use other translation software).

More information about translating a WordPress theme can be found in this article from Wptuts+.
More information about load_theme_textdomain() from the Codex pages.

share|improve this answer
1  
Actually, *.po is just Poedit's extension name. It's the *.mo file you'll need. –  Cor van Noorloos Feb 28 '13 at 10:49
add comment

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.