Hello,
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:
and add the following code after it:
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.
Regards,
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:
PHP:
$languages = (XenForo_Application::isRegistered('languages')
? XenForo_Application::get('languages')
: XenForo_Model::create('XenForo_Model_Language')->getAllLanguagesForCache()
);
and add the following code after it:
PHP:
// 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.
Regards,