I added this code to my functions.php file
add_filter('locale', 'wpse27056_setLocale');
function wpse27056_setLocale($locale) {
if ( is_admin() ) {
return 'en_US';
}
return $locale;
}
so the frontend is available in ro_RO
and wp-admin
is available in en_US
Well… that almost worked excepting Yoast’s WordPress SEO plugin which is translated in romanian.
What can i do with that plugin to be displayed in english?
That plugin loads its language the moment its main file is included:
So when your
locale
filter is used, the language is already there. :/Move your small plugin into the
mu-plugins
directory. You can create it if it doesnât exists inwp-content
. That should load your plugin earlier than Yoastâs.Lesson: Never load your language files before
wp_loaded
.There is even a better solution: a filter called
plugin_locale
. It filters the locale argument before using it inload_plugin_textdomain
.