An updated answer for Wordpress 4+
@rofflox's answer is still correct, but there have been some changes to Wordpress that can have an effect when using his function 'as-is' since WP 4.0.
The wp-config constant WPLANG
has been deprecated in favour of setting the site language via a dropdown in Settings->General
. This means that, after changing your site's language to Svenka (for example), your site's admin will appear in English... but that Site Language dropdown in Settings->General
will be pre-selected as English (United States). That means that, if you make changes to your General settings later on and forget to pick Svenka as your site's language again, the whole site will revert back to English.
I would recommend creating functions in your functions.php
file like so:
// Set the locale; original function from @rofflox
function vnmFunctionality_setLocale($locale) {
if (is_admin()) {
return 'en_US';
}
return $locale;
}
add_filter('locale', 'vnmFunctionality_setLocale');
// Enqueue a script to force-set the Language dropdown on the General Options page, just in case we forget about it later.
function vnmFunctionality_countryReminderScript($hook) {
if ($hook != 'options-general.php') {
return;
}
wp_enqueue_script('lang-reminder-script', get_template_directory() . '/js/site-language.js', array('jquery'), '1.0.0', true);
wp_localize_script('lang-reminder-script', 'langObject', array(
'lang' => get_option('WPLANG'),
));
}
add_action('admin_enqueue_scripts', 'vnmFunctionality_countryReminderScript');
And then a Javascript file called site-language.js
(saved in a /js/
folder in your theme) like so:
jQuery(document).ready(function($) {
$('select#WPLANG').val(langObject.lang).change();
});
This should automatically pre-select the site's current display language in the dropdown on the Options page, so that you don't have to remember to do it manually every time.