0

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?

2 Answers 2

1

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.

2
  • 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
    Commented Feb 28, 2013 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)
    – user5424
    Commented Feb 28, 2013 at 11:05
0

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.

1
  • 1
    Actually, *.po is just Poedit's extension name. It's the *.mo file you'll need.
    – user5424
    Commented Feb 28, 2013 at 10:49

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.