Translating The Theme

The theme is localisation ready so all that is needed is your translation. This documentation covers two methods to create your translation. The easiest method is to use a plugin called Loco Translate and more advanced users can use Poedit.

Loco Translate

Translation

Step 1: To set your default site language go to Settings > General and select your language from the Site Language dropdown menu.

Step 2: Go to Plugins > Add New, search for “Loco Translate” and install and activate the plugin.

Translating Theme

Step 1: Go to Loco Translate > Themes, select the Aardvark theme (if you’re using a child theme make sure you select the parent theme) and click the New language link.

Step 2: This will take you to a page where you can choose the language and location. Select the language that matches the one you selected from Settings > General and set the location to “System”.

Step 3: Once you’ve done this you can translate the theme.

Translating Plugin

Some of the theme text, such as WPBakery Page Builder elements is included in Aardvark Plugin.

Step 1: Go to Loco Translate > Plugins, select the Aardvark Plugin and click the New language link.

Step 2: This will take you to a page where you can choose the language and location. Select the language that matches the one you selected from Settings > General and set the location to “System”.

Step 3: Once you’ve done this you can translate the plugin.

Updating Translations

If you update the theme and new text needs to be translated you also need to update the language file as follows:

Step 1: For the theme go to Loco Translate > Themes, select the Aardvark theme and edit your language file.

Step 2: For the plugin go to Loco Translate > Plugins, select the Aardvark Plugin and edit your language file.

Step 3: Click the Sync button to load all the new text from .pot translation file to your language file (.po).

Poedit

Translation

Step 1: To set your default site language go to Settings > General and select your language from the Site Language dropdown menu.

Step 2: Install and open the translation program Poedit.

Translating Parent Theme

Step 1: Go to File > New From POT/PO File and open the translation file from aardvark-theme/aardvark/languages/aardvark.pot.

Step 2: You will be asked to specify the language you want to translate to.

Step 3: Now click on each string and enter your translation in the text box.

Step 4: After translating the strings save your file. The filename should be prefixed with “aardvark” followed by the country code, so a Norwegian translation will be saved as aardvark-nb_NO.po.

Step 5: Poedit will create a .po and .mo file containing your translations. Upload these files to wp-content/languages/themes/.

Translating Child Theme

Step 1: Add the following code to your child theme’s functions.php file (this has already been added in newer versions):

function ghostpool_child_theme_language() {
	$language_directory = get_stylesheet_directory()  . '/languages';
	load_child_theme_textdomain( 'aardvark', $language_directory );
}
add_action( 'after_setup_theme', 'ghostpool_child_theme_language' );

Next create a languages folder (this has already been added in newer versions) in your child theme directory and copy aardvark.pot translation file from the parent theme into this folder.

Next go to File > New From POT/PO File and open the translation file from aardvark-child/languages/aardvark.pot.

After translating the strings save your file. The filename should NOT prefixed with “aardvark”, so a Norwegian translation will be saved as nb_NO.po.

Poedit will create a .po and .mo file containing your translations. Upload these files to wp-content/themes/aardvark-child/languages/.

Translating Plugin

Some of the theme text, such as WPBakery Page Builder elements is included in Aardvark plugin.

Step 1: Go to aardvark-theme/aardvark/plugins/ and unzip the aardvark-plugin.zip.

Step 2: Next go to File > New From POT/PO File and open the translation file from aardvark-theme/aardvark/plugins/languages/aardvark-plugin.pot.

Step 3: You will be asked to specify the language you want to translate to.

Step 4: Now click on each string and enter your translation in the text box.

Step 5: After translating the strings save your file. The filename should be prefixed with “aardvark-plugin” followed by the country code, so a Norwegian translation will be saved as aardvark-plugin-nb_NO.po.

Step 5: Poedit will create a .po and .mo file containing your translations. Upload these files to wp-content/languages/plugins/.

Updating Translations

If you update the theme and new text needs to be translated you also need to update the language file as follows:

Step 1: For the theme insert your modified translation file (e.g. aardvark-en_US.po) into the aardvark-theme/aardvark/languages/ folder.

Step 2: Now open this file in Poedit and click Update and it will display the text changes from the latest theme update.

Step 3: Upload your updated .po and .mo files to wp-content/languages/themes/.

Step 4: For the plugin insert your modified translation file (e.g. aardvark-plugin-en_US.po) into the aardvark-theme/aardvark/plugins/aardvark-plugin/languages/ folder.

Step 5: Now open this file in Poedit and click Update and it will display the text changes from the latest theme update.

Step 6: Upload your updated .po and .mo files to wp-content/languages/plugins/ directory.