0

Using last version of Wordpress, I am stuck here. I can't translate my theme, some of the strings remain in english (I want french).

I use Poedit and generated the .mo file.

I pasted it in :

/themes/homeland-child/languages/fr_FR.mo

I checked in it, I find my translated strings.

homeland-child is my theme, it's a child from homeland theme.

But, strings are still in English on the website.

For example Leave a comment remains in English on the site.

My site is in french, dunno if there is a kind of cache ?

0

1 Answer 1

0

Ok, found on a blog this solution, paste in functions.php of your child theme :

function child_theme_slug_setup() {
    load_child_theme_textdomain( 'parent-theme-domain', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'child_theme_slug_setup' );
4
  • This code shows your child theme loading the parent theme's text domain. The parent should load its text domain. The child should load its text domain. They are separate and not inherited.
    – Tim
    Jul 17, 2019 at 8:59
  • Some tips here: localise.biz/wordpress/plugin/child-themes
    – Tim
    Jul 17, 2019 at 9:02
  • I don't understand ? My code makes the child theme to load the language file located in the child theme, and I keep the parent domain, since I want to override all translations. I will not recreate a text domain only for the child, the aim here is to override (the aim of a child theme for me) Jul 17, 2019 at 9:04
  • You are free to do it any way you like if it works for you, but my recommendation is in that link. My recommendation is based on seeing hundreds of people very confused about how localization works in child themes. Your code suggestion may work for you, but spreads poor advice that others may follow.
    – Tim
    Jul 17, 2019 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.