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

admin2025-06-06  6

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');

 }
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749193342a317143.html

最新回复(0)