How to Translate a WordPress Theme

All RED SUN DESIGN themes can be translated into any languages without having to edit the template files. To translate a theme, you can use  Poedit, which is a free, open source tool.

Once you’ve downloaded and installed Poedit, follow the next steps to translate the theme:

 

1. CREATE THE .PO FILE FOR YOUR LANGUAGE
  • Look for the default.po file, which is included in your theme files and open it with Poedit.
  • You should see a list of all strings (in English) used in the theme. Go through the list and click on the text that you want to translate. When you click a line of text, the same text will appear at the upper of the 2 boxes at the bottom. Enter the translation for the text in the lower box. Now go through and translate all the text, one line at a time.
  • If you right click on any line, you’ll see a file name and line number like “archive.php line 71″. That is the place in the theme files where this text is being used.
  • If you are looking for a certain text that you want to translate, click Edit > Find .
  • If a text string is prepared for translation in the theme but does not appear in the .po file (yet), click Catalog > Update from sources .
  • In Poedit > Preferences > Editor, make sure Automatically compile .mo file on save is checked. That way, when you click File > Save as, it will automatically output a .po and .mo file. The naming of your .po and .mo files is important. The naming convention is based on the language code (e.g. pt for Portuguese) followed by the country code (e.g. _PT for Portugal or _BR for Brazil). So, the Brazilian Portuguese files would be called pt_BR.po and pt_BR.mo. A complete list of codes can be found at language codes and country codes.
  • You can always open your .po file again (in Poedit) and add translations.

 

2. CHANGE YOUR WORDPRESS INSTALLATION TO YOUR LANGUAGE

In your WordPress admin go to SETTINGS > GENERAL > SITE LANGUAGE and select your language.