How to translate the theme from the child theme

How to translate the theme from the child theme

Essentials theme is translation-ready. The theme includes a /languages directory in the root and a .pot that includes all strings that are ready for translation.

The typical way to translate a WordPress theme requires that you use .po and .mo files in the /languages directory of the theme. However, if you make any edits to a parent theme, including adding translation files to the theme, your edits will be overwritten (and completely lost) once the theme is updated. So this is not a good method.

Instead, it is best to upload your translation files directly to your child theme /languages folder. Follow the steps below.

1. Use Poedit (or similar tool) to create translation files.

Find the needed .pot file in the /languages directory, which is located in the root of essentials theme folder. Use that .pot file in a translation tool like Poedit to create your .po and .mo translation files.

2. Edit child theme functions.php file.

Add the following code to the functions.php file:

function child_theme_slug_setup() {
   load_child_theme_textdomain( 'essentials', get_stylesheet_directory() . '/languages' );
add_action( 'after_setup_theme', 'child_theme_slug_setup' );

3. Add your translation files.

Upload your .po and .mo files to the /wp-content/themes/essentials-child/languages directory. If you do not have a /languages folder in your child theme, create it. The file names should follow this format: fr_FR.po & (example for French translation). Your file names should not include the theme slug.

Translating pixfort core plugin (Optional):

Add the following code to the functions.php file:

function child_theme_plugin_slug_setup() {
   load_child_theme_textdomain( 'pixfort-core', get_stylesheet_directory() . '/languages' );
add_action( 'after_setup_theme', 'child_theme_plugin_slug_setup' );

To translate pixfort core plugin you should translate the .pot file of the plugin which you can find in the plugin directory inside the /languages directory, after that add the .mo & .po translation files into the same /languages directory in the child theme, the translation files of the plugins should have the plugin name as a prefix, for example pixfort core translation files names (for French language) should be &

Essentials support team

Hey, this is pixfort support team, if you still need help you can always reach us via the chat messenger in your account on pixfort hub

Related Posts