使用plugin\\u区域设置筛选器:
apply_filters( \'plugin_locale\', $locale, $domain );
更改区域设置如下:
$my_plugin_domain = \'my_plugin_domain_name\';
$override_locale = \'es-ES\';
add_filter(\'plugin_locale\',
function ($locale, $domain) use ($my_plugin_domain, $override_locale) {
if($domain == $my_plugin_domain) {
$locale = $override_locale;
}
return $locale;
}, 10, 2);