Tcl Source Code

View Ticket
Login
Ticket UUID: 3036566
Title: msgcat ignores UI language setting on Windows 7
Type: Bug Version: obsolete: 8.5.8
Submitter: patthoyts Created on: 2010-07-29 12:33:03
Subsystem: 30. msgcat Package Assigned To: oehhar
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2013-09-17 07:09:26
Resolution: Accepted Closed By: oehhar
    Closed on: 2013-09-17 07:09:26
Description:
On Windows 7 and possibly Vista the user can now install language packs for certain versions. This is available for Windows 7 Ultimate and Professional but not for the Home versions I believe. This means I can install a Japanese UI language pack and use the control panel to select Japanese as my UI language even though the system locale was English.
Tcl's msgcat package ignores this.
The current code examines the Control Panel\International registry and determines the system locale. However the UI locale is being stored in Control Panel\Desktop\PreferredUILanguages as a country-language code (eg: ja-JP for Japanese). The name of the value suggests it might become a list but I don't know what separator might get used.
Attached is a patch to look for this registry value and use it if possible to override the system language. This patch is against 8.5.8 (msgcat 1.4.3)
User Comments: oehhar added on 2013-09-17 07:09:26:
Included in msgcat 1.5.2 and shipped with tcl 8.5.15 and 8.6.1
Thank you all,
Harald

oehhar added on 2013-05-08 15:44:59:
Sorry, I missed this bug report.

Here is my proposed patch with current tcl86.0.
http://core.tcl.tk/tcl/timeline?r=bug3036566
To test it on tcl8.5.x, you may just take the msgcat folder and copy it to this version.

On my Vista, this registry key is not present. Could you please check, if it works for you ?

Any other comments welcome.

Sorry,
Harald

added on 2013-05-08 01:13:09:
I can confirm GetUserDefaultUILanguage() returns right UI language on my English Windows 8 with English UI language, Russian regional settings and Russian "locale for non-unicode programs". msgcat incorrectly gets Russian.
% package require twapi
4.0a17
% twapi::map_langid_to_name [twapi::get_user_ui_langid]
English (United States)
% package require msgcat
1.5.0
% msgcat::mcpreferences
ru_ru ru {}

added on 2010-11-01 17:32:53:
Notice that the 'Locale' word is completely different on Windows (7 at least). It refers strictly to the 'programs that don't have unicode default method' which is completely unrelated to any 'language display' feature.

Basically they have:

Locale = unrelated to language display, just for printing characters.

Location = unrelated to language display, just for using currencies, time etc.

Display Language (which can be updated with packages to others) - The only one apparently on settings that actually refers to displaying a language for the system.

patthoyts added on 2010-08-24 23:29:24:
In reality we should probably somehow be calling GetUserDefaultUILanguage() (available since Win2k). Need to confirm this on some multilingual systems.

patthoyts added on 2010-07-29 19:33:04:

File Added - 381602: msgcat.patch

Attachments: