how to change CultureInfo.CurrentCulture in CF

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there

I would like to know how to change CultureInfo.CurrentCulture to specific culture like ("zh-TW"), in .NET I use Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("zh-TW") to let it work. Pls advise

Lina
 
I don't think this is possible in Compact.
CurrentCulture is not supported (if I remeber correctly it will not
compile).
You can use a set CultureInfo in things like DateTime :

CultureInfo ci_CultureInfo = new CultureInfo("el");
s_BottomLabels = string.Format("{0} :
{1}",s_Today,dt_Today.ToString("D",ci_CultureInfo));

Would show the Long Date in Greek on a German mashine.

I am preparing a DateTimePicker with CultureInfo support and the demo reads
in all supported CultureInfo's
on the Mashine and most Asian/Arab cultures are not supported (at least on
my Pocket PC 2002 German Mashine) - works on Desktop.
A preview as Desktop/Compact .EXE can now be downloaded at

http://www.mj10777.de/NETFramework/Articles/NetDtPExplorer/index.htm

Once I get the Control working in the Toolbox the source will be supplied.

It would interest me if there are Mashines that support Asian Cultures and
if they show up in the Demo (NetDtpExplorer).

Mark Johnson, Berlin Germany
(e-mail address removed)



Lina said:
Hi there,

I would like to know how to change CultureInfo.CurrentCulture to specific
culture like ("zh-TW"), in .NET I use Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture("zh-TW") to let it work. Pls advise!
 
Hi

In addition to Mark's comments about using methods that take CultureInfo as
one of their parameters...

Generally you allow the user to change the language of the device and when
they restart your app the changes take effect.. If you need to do that
programmatically you must PInvoke the below (and again you will need to
restart your app):

<System.runtime.interopservices.DllImport("coredll.dll",
SetLastError:=True)> _
Public Shared Function SetUserDefaultLCID(ByVal LCID As Int32) As Boolean
End Function

If you are on a MUI system you may need to call SetUserDefaultUILanguage as
well and the system will need a restart...

Cheers
Daniel


Lina said:
Hi there,

I would like to know how to change CultureInfo.CurrentCulture to specific
culture like ("zh-TW"), in .NET I use Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture("zh-TW") to let it work. Pls advise!
 
Hi Lina,

.NetCF does not support per-thread culture settings - you can only query
device default culture using CultureInfo.CurrentCultre. It deffers to
device locale and you can't change it programmatically. If user changes
device locale, it'll be automatically picked up on the startup of your app.
You can create arbitrary CultureInfo objects (assuming device itself
support the corresponding locale) and pass them to any culture-sensitive
API (such as number or date/time parsing and formatting APIs). Every
culture sensitive API typically has an overload taking CultureInfo as a
parameter. If no CultureInfo is provided, device culture is used instead.

Roman

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| Thread-Topic: how to change CultureInfo.CurrentCulture in CF
| thread-index: AcQA/KmTOB93WoRITuWliPCB5XAdUg==
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| From: "=?Utf-8?B?TGluYQ==?=" <[email protected]>
| Subject: how to change CultureInfo.CurrentCulture in CF
| Date: Wed, 3 Mar 2004 00:51:05 -0800
| Lines: 5
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:47511
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi there,

I would like to know how to change CultureInfo.CurrentCulture to specific
culture like ("zh-TW"), in .NET I use Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture("zh-TW") to let it work. Pls advise!

Lina
|

T
 
Back
Top