qTranslate admin language

None of the wordpress admin locale switcher plugins work, when you are using qTranslate and qTranslate does not have a separate option for admin locale, therefore to specify any other locale then the default content locale you’ll have to add the code below to qtranslate/qtranslate_hooks.php:

 * This filter hook allows wordpress admin locale to be
 * different then your default qTranslate content language
function qtrans_mofileFilter($mofile) {
	// replace "en_US" with your preferred admin language
	if (is_admin() || is_login())
		return WP_LANG_DIR."/en_US.mo";
	return $mofile;
add_filter('load_textdomain_mofile', 'qtrans_mofileFilter', 0);

function is_login() {
	return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'));

tested with WordPress version 3.2.1 and qTranslate version 2.5.24

5 Comments on “qTranslate admin language

  1. Finally, after all the struggling with ‘I need wp admin in English, although not using it as a qTranslate language at all’, I found your post. Thanks a bunch!

    There is one question though. Maybe two of them.
    1. Your solution turns the admin menu to any language you need, however the qTranslate page remains in the language set as default for the site. Any ideas how to bend it all back to one language (preferably English)?
    2. I was wondering why did you use the conditional lv_LV language. It seems to me that regardless of what qTranslate-default-content-language is picked, I would most likely want this hook to make the admin interface always English. Or is this intended to let people switch all the rest of the languages normally, just the default one replacing with something custom?

    Thank you again and have a great day! 🙂

    • Hi,
      Yes you’re right! I didn’t actually need the conditional.
      I have found a solution for the login page (and UPDATED the post accordingly), though I don’t know how to do that for the admin bar.
      Cheers, and have a great day!

      • Hello Kasp.
        You are referring to the login page. Did you manage by any chance to have the flags in the login/register/forgot password pages?

        Thanks a lot!