Home/Tutorial/WordPress/Add Multilanguage Support to WordPress plugins and themes
Add Multilanguage Support to WordPress plugins and themes 2016-12-05T10:50:08+00:00

Add Multilanguage Support to WordPress plugins and themes

1.0 Language Files Basic

po (portable object) and .pot (portable object template) extensions for the translation files.
POT files are basically the template files for PO files (Warning: Microsoft also uses POT as the extension for PowerPoint template files, but these are not the same). They will have all the translation strings (the msgstr parts) left empty, for example:

msgid “Hello world”
msgstr “”

PO files are the files which contain the actual translations. Each language will have its own PO file, for example, for French there would be a fr.po file, for german there would be a de.po, for American English there might be en-US.po.
MO files: MO, or Machine Object (machine readable)
Introduction to Gettext:
Gettext is the localization system that WordPress uses to load translations. WordPress reads the Gettext MO file format. These are the human-friendly source files from which the binary MO format is compiled. WordPress does not read PO files. gettext uses the concept of text domains, and so does WordPress.
The French PO file (fr.po) is then simply a copy of the POT file but with the translations filled in. For example:

theme_name.pot (the template file)
de.po & de.mo (a copy of the POT file with translations for German (de)
ru.po & ru.mo (a copy of the POT file with translations for Russian (ru)

 

2.0 Setting the language for your site

Open your wp-config.php file in a text editor and search for:
define (‘WPLANG’, ”);

For Portuguese spoken in Brazil

define (‘WPLANG’, ‘pt_BR’);

 

Video Tutorials & Remaining Steps for this lesson are only available for our Premium Students.

 

Next Steps: (Details Discussion available in Video Tutorial)
3.0 Get the theme / plugins
4.0 Check you can switch language
5.0 Set up the folders
6.0 Check the theme contains a POT file.
7.0 Find the theme in the translation dashboard
8.0 Add a new language
9.0 Translate some strings
10.0 Check the files exist
11.0 Viewing the translated theme

 

WordPress Theme Development For ThemeForest