Skip to content
Tcl Source Code View Ticket
Login

View Ticket

msgcat ignores UI language setting on Windows 7

Closed / Accepted3036566fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 13 years ago
Descriptionplain2010-07-29 12:33:03
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)
patthoytsplain2010-07-29 19:33:04
File Added - 381602: msgcat.patch
patthoytsplain2010-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.
plain2010-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.
dgp Ticket [3036566fff]: 1 change [History diff]2012-06-23 03:42:05
plain2013-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 {}
oehharplain2013-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
oehharplain2013-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
Log in (anonymous is fine) to add a comment.

Attachments: