views:

68

answers:

1

In a standard .NET framework application (not CF), I can change the user UI culture with:

System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("es-AR");
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;

but the .NET CF 2 doesn't support CurrentUICulture for CurrentThread.

So far, I found here that maybe the UI culture can be changed by setting

[HKEY_LOCAL_MACHINE\nls\overrides]\LCID
[HKEY_CURRENT_USER\MUI]\CurLang

but it requires rebooting the device after the change. Is there any other way to do it?

TIA, Pablo

+1  A: 

Yes, there is. Instead of hacking the registry, use the documented SetUserDefaultUILanguage() API function. From the remarks section of that API:

The new LANGID will not take effect until the device is reset.

Can't get around that. Shouldn't be a problem, users don't change their native language frequently.

Hans Passant
Mm, from the Visual Studio 2008 .NET CF Help:"You cannot set current culture programmatically on a device. They are set by the device manufacturer..."and no help on SetUserDefaultUILanguage, it appears to be supported in .NET CF 4.2 (I'm using .NET CF 2)
PabloG
You have to P/Invoke it.
Hans Passant