admin管理员组文章数量:1130349
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 badges1 Answer
Reset to default 0Actually 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');
}
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 badges1 Answer
Reset to default 0Actually 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');
}
本文标签: How to get custom translations from child theme to be loaded
版权声明:本文标题:How to get custom translations from child theme to be loaded? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749193317a2330480.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论