Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting correct user LCID on XP with French LP selected

117 views
Skip to first unread message

Jan M

unread,
Jun 1, 2010, 4:18:44 PM6/1/10
to
Hi,

I have XP with the French language pack installed (and XP SP3).

When French is selected as the user language GetUserDefaultLCID() returns 0x0809 (1252) (UK English) and
GetSystemDefaultLCID() returns 0x0409 (1033) (US English). (No problem as I only use the lower 8 bits of the LCID, i.e.
0x09 for English or 0xC0 for French).

All the system messages are in French.

How do I get the system to return the French LCID 0x040C (1252) when the user locale is French?

Is there some other way to detect the user's selected locale other than GetUserDefaultLCID().

Thanks,

Jan

Mihai N.

unread,
Jun 2, 2010, 1:43:18 AM6/2/10
to

> I have XP with the French language pack installed (and XP SP3).
>
> When French is selected as the user language GetUserDefaultLCID()
> returns 0x0809 (1252) (UK English) and
> GetSystemDefaultLCID() returns 0x0409 (1033) (US English).

What do you mean by "French is selected as the user language" ?
The language of the UI? (in which the interface is translated)
That is not the user locale, that is the UI locale.

Short guide to lingo:

- User locale = used for locale sensitive operations
(time/date/number/currency formatting, sorting, etc.)
=> GetUserDefaultLCID

- System locale = used by non-Unicode applications
Determines the ANSI and OEM code pages
=> GetSystemDefaultLCID

- UI locale = determines the localization of the interface
=> GetUserDefaultUILanguage => returns a LANGID

- Default system UI language = the language of the UI in which
the OS was initially installed
=> GetSystemDefaultUILanguage


--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

Jan M

unread,
Jun 2, 2010, 6:43:11 AM6/2/10
to

Hi Mihai,

Thanks for your reply.

My executable is a Windows Installer (MSI) "Custom Action".

From my research it appears that with a custom action spawned by MSI, GetUserDefaultLCID() and
GetUserDefaultUILanguage() return the country code of the .msi file not the users locale or language.

Running the executable as opposed to spawning from MSI results in the correct country code being returned.

Regards,

Jan

Jan M

unread,
Jun 2, 2010, 1:53:37 PM6/2/10
to

Further to my last post.

Even if the .msi file localization is "French" and the user Language Pack selected is also "Francais (French)", an MSI
Custom Action calling GetUserDefaultLCID() and GetUserDefaultUILanguage() return 0x0809 and 0x0409 respectively.

Jan

Mihai N.

unread,
Jun 3, 2010, 5:14:19 AM6/3/10
to

> Even if the .msi file localization is "French" and the user Language Pack
selected is also "Francais (French)", an MSI
> Custom Action calling GetUserDefaultLCID() and GetUserDefaultUILanguage()
return 0x0809 and 0x0409 respectively.

It is very likely that the msi, doing install stuff, runs in the context
of the Administrator, not the current user. So any GetUser* will get Admin
settings, not the current user.


If you can span something from the msi and report the user and group, might
help find a workaround.

Something that might work is to change from Regional Settings, Advanced tab.
Check the "Apply all settings to the current account and to the default user
profile"
http://library.ust.hk/images/advanced-tab.jpg


Or you might login as Administrator and change the settings.

Not sure which method will ork, or if any of them will work.
The best thing is to span an exe, report user/group, and will go from there.

Jan M

unread,
Jun 3, 2010, 12:32:41 PM6/3/10
to

Hi Mihai,

Thanks for your suggestions. I will look into them when I get a moment. Meanwhile I have handled the problem by passing
the language code of the .msi file to the Custom Action on the command line. As MSI expects a different .msi file for
each language this will sort the problem in the short term.

Regards,

Jan

P.S. As this forum is officially closed, where should I post language questions in future?

Mihai N.

unread,
Jun 4, 2010, 3:20:00 AM6/4/10
to
> P.S. As this forum is officially closed, where should I post
> language questions in future?

Franckly, I don't know :-(
There is no new forum dedicated to internationalization.
You might have a decent chance at stackoverflow.com

0 new messages