Applying language files to X Child theme

Hi, I’m trying to apply the language files (.po, .mo) to my site using X and X Child theme.

So I put the files in /var/www/html/wp-content/themes/x-child/framework/lang, but it showed me any changes at all.

Then I put the files in /var/www/html/wp-content/themes/x/framework/lang, and then it worked.

Is it possible to apply language files using X child theme directory? Not a big problem, but I’m just curious.

Hi Arisa,

Thanks for writing in! First of all, please make sure that you have setup your child theme correctly by following our guide here (https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57) and also make sure to activate your child theme.

Then you can create languages folder inside your child theme /wp-content/themes/x-child/languages and then you need to add the following code into your child theme’s functions.php file to map your languages.

add_action( 'after_setup_theme', 'load_child_language' );
    function load_child_language() {
        load_child_theme_textdomain( '__x__', get_stylesheet_directory() . '/languages' );
}

Please refer to our detailed guide on translation for more information (https://theme.co/apex/forum/t/setup-translation/61).

Hope that helps.

Hello @mldarshana,

It works just perfect. Thanks for great help!

You are most welcome. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.