Using Codestyling Localization for Multilingual Site

Before we start

All our themes will support localization and include a language file (.po or .pot file) which contains all the English texts. You can find this language file inside the theme folder in themename / languages

Setup WordPress

The first step is to make sure your WordPress config file is setup with your locale. Open wp-config.php and modify the line below, or add it if it is missing. We’ve set it to Norwegian in the example below. See the complete list of language codes and country codes to find your exact locale.


 * WordPress Localized Language, defaults to English.


 * Change this to localize WordPress.  A corresponding MO file for the chosen

 * language must be installed to wp-content/languages. For example, install

 * to wp-content/languages and set WPLANG to 'de' to enable German

 * language support.


define ('WPLANG', 'nb_NO');

view rawwp-config.php hosted with ❤ by GitHub

Using Code styling Localization Plugin

To translate your theme, you must download the Codestyling Localization plugin, which allows you to translate the theme directly in the WP admin panel.

Install and activate the plugin and go to Tools » Localization (shown in your language), then follow the instructions on how to translate the theme.

Updating a theme

If you update your theme to a new version which has an updated language file, you’ll need to rescan your theme using the plugin and then translate the new strings. Find your theme in Code styling Localization plugin and click Rescan to have the plugin update the PO file.

After you have rescanned your theme, click Edit to translate any new strings the plugin found after rescanning. Remember to generate a new MO file after you have translated your new strings.

Translating a child theme

If you are using a child theme and have template files in the child theme that needs to be translated, you need to translate this through Codestyling as well. To make the plugin recognize your child theme so it can scan it, you need to add this line in functions.php file in your child theme (if you haven’t already got one) and add the following:



// Load the textdomain for translation

load_child_theme_textdomain( 'spyropress' );



view rawfunctions.php hosted with ❤ by GitHub

Now you can use the plugin to translate your child theme as well!


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk