开发者

Change UI culture programmatically in WinCE 5 / .NET CF 2

开发者 https://www.devze.com 2023-01-08 11:34 出处:网络
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

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

[开发者_C百科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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号