Theme includes POT translation file so you can use standard translation tools to help translate theme output strings to your desired language.
WordPress Translation Setting
For Pre-Wordpress 4.0 users please follow below steps
- Login to your FTP account and edit wp-config.php file.
- In wp-config.php file, look for WPLANG constant for example define(‘WPLANG’, ”);
- Define WPLANG constant by adding ISO language code of your desired language. For example if you want to add German language. Use this code define(‘WPLANG’, ‘de_DE.po’);
For WordPress 4.0 + users please follow below steps
- Login to your WordPress Dashboard and navigate to Settings > General Settings
- Make sure “Site Language” option is set to your desired language.
Storing Translation Files
By default storing inside theme folder. The theme language file is wp-content/themes/grandspa/languages/grandspa.pot this method has one downside. Because when every you update the theme. The whole language folder will be replaced with original version which overwrite your translation files.
IMPORTANT: So the solution is to backup your translation file before updating theme.
Translating The Theme
Before proceed, you would required having translation app on your computer. We recommended POEdit app which is industry standard and it’s also free.
Theme use PO translation file which is industry standard translation method. In theme folder you will find a folder called languages. You will find each languages files store in the folder.
- *.pot, *.po – A lists of all text strings in theme. The text strings are in English and you can add translation to each of text string.
- *.mo – This is the compiled .po file and is used by WordPress to translate the theme
If your language isn’t included in the theme language files. You have to create a new .po file from original grandspa.pot located in theme’s languages folder then save the new .po file with your language code for example de_DE.po
Translating The Custom Post Type Plugin
Custom Post Type Plugin use PO translation file which is industry standard translation method. In plugins folder you will find a folder called languages. You will find each languages files store in the folder.
If your language isn’t included in the theme language files. You have to create a new .po file from original grandspa-custom-post-en_US.pot located in theme’s languages folder then save the new .po file with your language code for example grandspa-custom-post-de_DE.po
How to translate Po file using Poedit Application
Poedit application is the popular application uses to edit po file translation and it’s free. Click here to download Poedit application.
Now download and install Poedit application. Open language file you want to translate for example en_US.po You will find all English string in Source Text box.
Select text string you want to translate, add your translation text to “Translation” field. Once you finish translating. Save the file and it will automatically compiled to .mo file.