- 1. Download and Install PoEdit software: https://poedit.net/
- 2. Unzip the theme file you have downloaded from ThemeForest.
- 3. In the folder /Theme/ you will see the theme .zip file. Unzip it as well.
- 4. Open Poedit and click on File -> New catalog from POT file in the main menu and select the POT file in your theme’s languages folder. The .POT file should be located in your /Theme/theme_name_folder/languages/
- 5. A properties box will open up where you must enter some general information. First up, in the Language field enter the language name you want to translate.
- 6. Click the “OK” button; you’ll be asked what you want to name your translation file. Each language and country has a specific code you will need to use when saving translation files; for instance, if you’re going to translate into Spanish you’ll name your file “es_ES.po”, whereas if you’re translating into German you’ll name the file “de_DE.po”, french from France will be fr_FR.po, french from Canada will be fr_CA.po. To break it down; the first lower-case letters define the language, whereas the second upper-case letter define the country. In many cases the language and country will be the same, hence “de_DE” for Germany, but what about languages like English or Portuguese, that are spoken in several countries natively? In these cases there will be a difference in the first and second letter pairs; for the UK, the code would be en_GB, whereas for the USA it will be en_US. If you’re not familiar with the codes for your native language and country you can head over to the GNU website, where they have all the codes for Language and Country. Remember, if you use the wrong naming convention WordPress won’t be able to use your translation, so double-check if necessary.
- 7.Save your new language file.
8. Now you can start translating the theme via the String Translation mechanism. This provides direct like-for-like translations. Go through each line one-by-one, adding the translation to your native language as you go.
9. If you think there’s some text that won’t require translation or you’re not sure what to translate it to you can just leave them as they are in the original language; you can always come back and translate them later if need be. You can translate only portion of it. You don't have to translate everything. Remember that strings that you have not translated will appear in english in your site. The string you have translated will shows the corresponding translations. To illustrate how easy the translation process is, here’s a shot from the Polish translation process:
- 10. Don’t forget to save your file once you finish the translation. Go to File > Compile to MO. Save your mo file and then save the .po file. Remember this: .PO file is the PoEdit SOURCE file, while .MO file is the file Wordpress READS. Wordpress doesnt care about your .po file but if you want to translate or modified one of the string later, I bet you will be happy to have the .PO file, then recompile the .mo file again.
- 11. Upload you .Mo and .Po file in wp-content/languages folder. See screenshot: http://d.pr/i/iVUn
Setup Wordpress to read your translation
You may have managed to successfully translate the entire file, but configuration is not over yet. Once translation has been finished, the first thing to do is to get your language and country code and keep it handy so you can tell WordPress which language file to use. You’ll need to make sure your wp-config.php file settings match your language files; this configuration file is located in the main directory (not in the theme directory. See screenshot: http://d.pr/i/1fQmH You’ll need to open the wp-config.php file and set your language accordingly, like this:
/** * WordPress Localized Language, defaults to English. * * Change this to localize WordPress. A corresponding MO file for the chosen * language must be installed to wp-content/languages. For example, install * es_ES.mo to wp-content/languages and set WPLANG to 'es-ES' to enable Spanish * language support. */ define('WPLANG', 'es-ES');
Share your language files with others
If you’ve already translated a theme then many of our users would be delighted if you could share your translation files with the community. Just get in contact with us via our Helpdesk ticket system and we will include the translation files in the next theme update if possible.
Translation tips: Character Encoding
If you’re used to working in HTML or through the WordPress editors then there are a few areas which might catch you out when creating the translations; here’s a few tips to help you get things done: First of all, any localizations should use UTF-8 encoding. This is one of the reasons we recommend Poedit; this kind of seemingly minor issue is already accounted for in a dedicated program. If you were to edit the files via a standard, simple editor like notepad, then the default settings will usually use different encoding. You won’t actually notice this when working on the file, but once you save it you’ll notice that all your translated elements are displaying the identifying string rather than the original or new language. You can just open and resave the file with the proper encoding, but using a dedicated program will prevent this happening in the first place, so it’s probably the safer solution! When writing your translations you should write your translations plainly; that is, avoid escaping accented and special characters with HTML character entities, save for a select group that are expected to be escaped to avoid conflict with XHTML markup: angle brackets (< & >), and ampersands (&). In addition, there are a few other characters that function better when escaped, such as non-breaking spaces ( ), angle quotes (« and »), curly apostrophes (’) and curly quotes. When we create multilingual sites, we need to remember that translation is not everything; localization goes beyond just translating words and expands to include adapting the site to a different language, country and conventions. Some words simply don’t mean the same thing or carry the same implications as other languages, so don’t translate literally; translate organically; try to get a feel for the meaning behind the original text, and capture that spirit in your translation.