All themes comes with GetText Catalog file (.PO) which contains all strings that are specific to the theme and won’t be translated when changing WordPress language itself. The files reside in /languages folder of the theme. To translate WordPress Find a list of language codes athttp://www.wordpress.org in your Language. As an example, the language code for English is en_EN.
Translating .PO file allows changing theme specific strings language. In order to translate .PO file follow proceeding instructions:
- Download and Install POEdit Software from http://www.poedit.net/download.php POEdit is cross-platform gettext catalogs (PO files) editor which provides compact view of data and very effective user interface.
- Extract the theme and copy the theme files into a new directory.
- Now open the PoEdit application, and create a new catalog (File » New catalog).
- From the menu, select Catalog » Settings and fill in all required information.
- Click on the Paths tab and change the local path from 1st line to your path with theme files and click “OK” then update the catalog (Catalog » Update from sources) to verify that your path to the theme is correct.
- Now you can start translating the theme by selecting each bold string in the list, and typing translation in editable area at the bottom.
- After you have completed string translations, save your catalog by using the language code_COUNTRYCODE file naming convention, eg. as fr_FR, and upload the compiled catalog that was generated by PoEdit (eg. fr_FR.mo) to your server, in the theme language directory.
- Now that you have a compiled translated file you need to instruct WordPress to use it (if you’ve already installed WordPress in another language you might have the next step done already). Open the file wp-config at the root of your WordPress installation and look for the following code:define (‘WPLANG’, ”);If, per say, in our above example we translated to French then we saved our file as “fr_FR.mo” and need to change this line of code to:define (‘WPLANG’, fr_FR ‘);
- If everything is done correctly, you should now see the frontend of your site in translated strings.
Obtain the localization files for WordPress by going to http://codex.wordpress.org/WordPress_in_Your_Language and download either a completely translated WordPress package, or just the localization files (.mo and .po files).
Locate the localization files They are named .mo and .po. If you downloaded a translated WordPress package, they are located in /wp-content/languages/.
Copy these files to wp-content/languages/. Open your wp-config.php file and find the line containing: define(‘WPLANG’, ”); And replace it with (this example is for French): define(‘WPLANG’, ‘fr_FR’); Remember to replace “fr_FR” with your language code.
Download and install Poedit, this is needed to generate the localization files Run Poedit Go to File > New catalog from POT file and open the plugin’s language template file located in /wp-content/themes/alice/languages/
Click OK to confirm the new catalog properties Poedit will prompt you to Save the file. Save it into the same folder as the .pot file and name it (this example is for French; replace “fr” with your language code): fr.po
ow you can translate each item in the catalog. Click Save to save your changes; Poedit will generate a fr.mo file which WordPress uses to load translations
It’s very easy to translate with Loco plugin. Please check here: Loco translate plugin