Recently, increasingly individuals are asking us learn how to translate a WordPress theme right into a language aside from English. And with an
This tutorial assumes the WordPress theme to be translated has been localized utilizing the the
1. Purchase or Create a POT File for Your WordPress Theme
POT stands for “Moveable Object Template,” and a POT file (aka .po file) is mainly an inventory of all of the English-language textual content discovered throughout the information of a localized WordPress theme. Yow will discover hyperlinks to the POT information for Solostream’s
For those who’re utilizing a theme aside from a Solostream theme (gasp), examine with the theme writer to see if they provide a POT file. In the event that they don’t, you’ll be able to simply create your personal POT file with a free program known as
2. Translate the POT File and Add to Your Theme Folder
After getting the POT file, you’ll must open it in a program like
Discover a record of language codes at
three. Inform WordPress What Language to Use
In case your theme doesn’t already embody it, you’ll want so as to add the next line to the very high of your features.php file (simply earlier than the opening
<?php load_theme_textdomain('text_domain'); ?>
Discover “text_domain” above – it’s known as the textual content area identify. You need to use any identify you need, however you need to use the identical identify that’s used all through the theme within the gettext perform.
So, for instance, in case your gettext features look one thing like this:
<?php _e("Concerning the Writer", "wp-inspired"); ?> …
You’ll wish to use “wp-inspired” rather than the text_domain above.
Lastly, should you haven’t accomplished so already, you’ll want to verify your wp-config.php file matches your language information. For instance, should you’re utilizing a French translation, you’ll want so as to add the fr_FR.po and fr_FR.mo information to your theme folder, then set your language in wp-config.php, like this:
outline ('WPLANG', 'fr_FR');
By the best way, your wp-config.php file is positioned in the principle listing the place all of your core WordPress information are positioned.
Save your wp-config.php file, add it to your WordPress set up, and you’re able to go.