• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum is for release discussion only. Discussions that do not relate specifically to the resource release should be discussed in another, more appropriate forum.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Setting different languages for the back-end and the front-end


Well-known member
It has been mentioned several times in these forums that some people would like to translate only the front-end related phrases and would like to keep the admin side in English. This will not only save the time required to translate the many thousands of texts related to the back-end, some people are more comfortable at having the interface language of the admin section in English. I have been pondering on how to do this in xenforo. I have come up with a code modification that achieves this effect. I am posting about my experience here to get a feedback from the others. Maybe we can find a better way of doing the same.

When I looked through xenforo's code, I found that the visitor's language is set in the setVisitorLanguage method of the XenForo_Visitor class. If you find the following code:

$languages = (XenForo_Application::isRegistered('languages')
            ? XenForo_Application::get('languages')
            : XenForo_Model::create('XenForo_Model_Language')->getAllLanguagesForCache()
and add the following code after it:

// get the Xenforo_FrontController instance
        $frontController= $GLOBALS['fc'];
        // get the dependencies object
        $dependencies=  $frontController->getDependencies();

        // check if it is the admin back-end
        if(is_a($dependencies, "XenForo_Dependencies_Admin"))
            // if yes, then set the language_id to the preset id
            $languageId=1; // this is just an example
This has the effect that your admin section will appear in the language that corresponds to the id set in the above code snippet, which in this example corresponds to English. I will be waiting for your comments on it.


You're having an event listener in the setup method, which could be probably used to do this without an file edit


        self::$_instance = $object;

        XenForo_CodeEvent::fire('visitor_setup', array(&self::$_instance));
Why not run setVisitorLanguage here again to overwrite the original set value?;)