最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How to get custom translations from child theme to be loaded?

matteradmin8PV0评论

I have a child theme that loads translations normaly but if i added custom translatable strings that doesn't exist into the parent, how to add these strings to the main po file or how to load it alongside the parent's translation.

I have a child theme that loads translations normaly but if i added custom translatable strings that doesn't exist into the parent, how to add these strings to the main po file or how to load it alongside the parent's translation.

Share Improve this question asked Nov 10, 2018 at 17:44 Mohamed OmarMohamed Omar 5191 gold badge5 silver badges17 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Actually my mistake, I was overriding the translation of the parent theme using it's text domain for child theme, while I should have defined a different text domain for child theme and load both domains into child theme's functions.php like this:

add_action( 'after_setup_theme', 'mr_load_textdomain' );

function mr_load_textdomain(){

  //for child
  load_theme_textdomain (MR_DOMAIN,get_stylesheet_directory().'/languages');
  //for parent
  load_theme_textdomain (ET_DOMAIN,get_template_directory().'/lang');

 }
Post a comment

comment list (0)

  1. No comments so far