How to Translate the Theme Using the Child Theme

How to Translate the Theme Using the Child Theme

pixfort Theme is translation-ready, allowing you to localize your website using a child theme. This guide will walk you through the process.

Note

If you haven’t installed a child theme on your website yet, please refer to this article for guidance: How to Install the pixfort Child Theme.​

1

Create Theme Translation Files Using Poedit

  1. Download and install Poedit or a similar translation tool.​
  2. Open the pixfort.pot file located in the /languages directory of the parent pixfort Theme.​
  3. Translate the strings into your desired language.​
  4. Save the translation as a .po file, naming it according to your language code (e.g., fr_FR.po for French).​
  5. Poedit will automatically generate a corresponding .mo file.​

2

Create pixfort Core Translation Files Using Poedit

In a similar way to the previous step, translate the pixfort core plugin strings as following:

  1. Open the pixfort-core.pot file located in the /languages directory of pixfort Core plugin.​
  2. Translate the strings into your desired language.​
  3. Save the translation as a .po file, naming it according to your language code with the pixfort-core- prefix (e.g., pixfort-core-fr_FR.po for French).​
  4. Poedit will automatically generate a corresponding .mo file.​

3

Add Translation Files to the Child Theme

Place all the .po and .mo files you generated into the /languages directory in the Child Theme.​

After that, and to make sure that WordPress is loading the translation files, please make sure to add the following code snippets into functions.php in your child theme (if the code snippet don’t exist):

function child_theme_slug_setup() {
load_child_theme_textdomain( 'pixfort', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'child_theme_slug_setup' );
 And to translate pixfort core plugin make sure that the following code snippet is also added into functions.php in your child theme:
add_filter('load_textdomain_mofile', function($mofile, $domain) {
if ($domain === 'pixfort-core') {
$locale = determine_locale();
// Path to your child theme's translation file
$child_mofile = get_stylesheet_directory() . '/languages/pixfort-core-' . $locale . '.mo';
if (file_exists($child_mofile)) {
return $child_mofile;
}
}
return $mofile;
}, 10, 2);

4

Set the Site Language

  1. Navigate to your WordPress dashboard.​
  2. Go to Settings → General.​
  3. Under Site Language, select the language corresponding to your translation files.​
  4. Save the changes.​

Your website should now display the translated text based on the .mo file you’ve added 👍

pixfort
pixfort
Support Team

Hey, this is pixfort support team, if you still need help you can always reach us via your pixfort account

Related Posts

Search

Start typing to search for a specific article on our website

Made with Popup Builder
Image link
Hey there

Search for a specific article

Get started

Check useful guides to get started

Still need Help?

Send us a support message

Our usual reply time: 1 Business day