Skip to content

Adding Translation Files To Your Child Theme

If you worked hard to translate the theme you probably don’t want to keep the translated .po and .mo files in the parent theme because they will be overwritten when you update the theme. The best solution would be to place them in your child theme which is very easy to do and is also explained right in the WordPress CODEX.

So basically you just have to add your languages into your child theme and then use (add to your child theme’s functions.php) the following function to load it from the child theme instead of the parent:

// Load translation files from your child theme instead of the parent theme
function my_child_theme_locale() {
    load_child_theme_textdomain( 'total', get_stylesheet_directory() . '/languages' );
add_action( 'after_setup_theme', 'my_child_theme_locale', 100 );

Then add your translated files inside a "languages" folder in the child theme.

Back To Top