Portable Object Template (POT)
The master theme (or plugin) translation file is a .POT file. Basically, the .POT file is a list of all the text lines used in the theme files in English language:
The .POT file can be found in the languages folder.
- Nordis theme: wp-content/themes/nordis/languages/nordis.pot
- PixCustom plugin: wp-content/plugins/pixtheme-custom/languages/pixtheme-custom.pot
Portable Object (PO) and Machine Object (MO)
The .PO file includes the original texts and the translations in two columns. It´s a translation that someone else started (the author, a professional translator, a WordPress theme user, etc), and maybe completed. WordPress doesn’t use it.
The .MO file includes the exact same contents as PO file. The two files differ in their format. While a PO file is easy for humans to read, MO files are compiled and are easy for computers to read. WordPress gets translations from .MO files.
The .MO file is automatically created by Poedit whenever you save a PO file. All you can do with these files is to upload or re-upload them whenever you create or update a .PO file.
Translate with Poedit
Poedit is a software (available for Windows, Mac and Linux) which you can use to translate the theme or plugin. It’s available for free on poedit.net. Free version comes with a builtin translation memory that remembers your past translations and uses them to make suggestions for similar texts.
Here are the steps:
- Open Poedit and select Create New Translation.
- Select the .POT file or the .PO file from the theme or plugin you wish to translate which (you can find the files in the wp-content/themes/your-theme/language/ folder).
- A box will pop up asking for language of the translation. Select your language:
- Hit OK and Poedit will name automatically your file. If you select German (Germany): de_DE.po (plugin_name-de_DE.po for plugin).
- Save the file to your computer.
- Now you can start translating your theme or your plugin. The space at the top will display all the text ready to translate, and any completed translations will display to the right. The boxes underneath show the source text, your translation and any notes for translators. Translating is really easy – just select a word or phrase, enter your translation.
It´s not necessary translate all text strings. Perhaps you don´t want to spend your time translating text strings of the admin theme.
- When you’ve finished, save your file. Poedit will automatically create both .po and .mo files. You´ll have to upload both to your theme’s or plugin’s languages folder.
Translate with Loco Translate plugin
Loco Translate is the best plugin to translate WordPress themes and plugins directly in your WordPress dashboard.
The Loco Translate plugin is great for localizing WordPress themes and plugins.
- PO editor within WordPress admin
- You can create and update language files directly in your plugin or theme
- Extraction of translatable strings
- MO file compilation
- PO file backups
- Built-in WordPress locale codes