Xibo server detects wrong language

Asked by willichan

In Internet Explorer (v8), no matter which order I put languages in, the Xibo server control pages detect my system language as Japanese. The only way to get English that I have found so far was to delete the ja.mo file, or move it to another folder. This is not a desirable solution, since we do have a mixed Japanese/English environment, and one of the users that will be updating layouts is Japanese.

How can I ensure that the Xibo server will come up as English for my system, but still allow others to work in Japanese?

Additional info:
I have added en-GB to IE, to match the existing en-GB.mo file, but there is no change in behavior.

Question information

Language:
English Edit question
Status:
Solved
For:
Xibo Edit question
Assignee:
No assignee Edit question
Solved by:
willichan
Solved:
Last query:
Last reply:
Revision history for this message
Dan Garner (dangarner) said :
#1

The only mechanism Xibo uses is the browsers preferred language setting...
it is very odd that it is not correctly detecting it.

Have you tried removing the Japanese language from IE (temporarily)?

Another thing to quickly try (to ensure it is detecting en_GB properly is to
append lang=en_GB to the URL.

Revision history for this message
willichan (willichan) said :
#2

Yes. Removing Japanese from IE or Firefox sets XIBO to English.

I have tried several PHP code samples for detecting my preferred language, and most of them have worked for me, but XIBO continues to select Japanese, regardless which language I have set as preferred.

All of the sample code I have tried that work look at the qvalue. XIBO ignores it.

I have tried this on several systems, both English and Japanese OS, with both IE and Firefox with the same results as my own PC.

This sample code seemed to work best:
http://www.php.net/manual/en/function.http-negotiate-language.php#86787

Revision history for this message
Alex Harrington (alexharrington) said :
#3

Xibo already correctly detects your browser preferred language. If you put
English or British English above Japanese in your browser preferences then
it will switch to English.

Revision history for this message
willichan (willichan) said :
#4

@Alex:

No. That is incorrect. No matter what order the languages are set in the browsers, XIBO detects Japanese. Moving Japanese to the bottom of the list, and EN_GB to the top makes no difference. XIBO still detects Japanese.

Revision history for this message
Alex Harrington (alexharrington) said :
#5

Please can you post a server log showing this then. I suspect you have
a strange capitalisation or similar of the English language preference
that isn't being detected - but I certainly get English in all the
browsers I use and not Japanese if I add Japanese to the bottom of my
list.

Alex

Revision history for this message
willichan (willichan) said :
#6

@Alex:

What server log would you like to see? I have no language information in my Apache server logs, and I do not see any logs for it in the XIBO server files. Let me know what you need.

For your testing, when you add Japanese support to your browser, are you adding "Japanese [ja-JP]" (which will not match since there is not an .mo file for it) or are you adding "Japanese [ja]" (which does have an .mo file)?

Here is a screenshot of my IE language settings:

http://www.freeimagehosting.net/c19a0

and the resulting admin screen:

http://www.freeimagehosting.net/c6d6a

Revision history for this message
willichan (willichan) said :
#7

I believe I have found the problem. The HTTP headers use a hyphen (-) between the base language and the sub-language if one exists. The .mo files provided with XIBO use an underscore (_) in the filenames. Therefore, if a language is specified in preferences that has no sub-language, a match is possible, but en-GB will never match, since the .mo file has an underscore. If your system is not configured with any "base-only" languages to match with the supplied .mo files, XIBO will default to English, giving the IMPRESSION that it has worked properly.

In the case where a "base-only" language is specified, it will give erroneous or correct results based on where the language is in the preference list.

By renaming the .mo filenames with hyphens instead of underscores, the language detection works correctly.

Revision history for this message
willichan (willichan) said :
#8

I would recommend having a fallback added to the language detection, so that if no preferred languages with a sub-language match available .mo files, that the system match by the base language only. For example:

en-US is a preferred language. Since it will not match against en-GB, the system should see if en is an available .mo file. Obviously, this also requires providing base language .mo files wherever possible.

Understandably, this would not work with languages such as Chinese, but by not providing a base .mo file for that language, it would then be ignored as it is under the current language detection.