admin管理员组文章数量:1410705
I'm currently using this to reload my theme and plugin textdomain in order to send e-mails (admin move, in admin language) in the user language.
add_filter("theme_locale", array($this, "theme_locale"), 9999, 2);
add_filter("plugin_locale", array($this, "plugin_locale"), 9999, 2);
$this->load_textdomains();
remove_filter("theme_locale", array($this, "theme_locale"), 9999, 2);
remove_filter("plugin_locale", array($this, "plugin_locale"), 9999, 2);
public function load_textdomains() {
if (function_exists("WC")) {
WC()->load_plugin_textdomain();
}
if (class_exists("My_Plugin_Class")) {
My_Plugin_Class::load_plugin_textdomain();
}
load_my_theme_textdomain();
}
And the theme/plugin functions works like this:
function load_my_theme_textdomain(){
unload_textdomain('my-theme-textdomain');
load_theme_textdomain('my-theme-textdomain', get_template_directory() . '/i18n/');
}
And thats okay, works fine. But in my e-mail, i translate things using WORDPRESS textdomain.
How can i reload wordpress default textdomain, at runtime, like this? The one that is used when using __ function without domain parameter.
本文标签: multi languageHow to reload wordpress textdomains at runtime
版权声明:本文标题:multi language - How to reload wordpress textdomains at runtime 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744861889a2629118.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论