PC Review


Reply
Thread Tools Rate Thread

how to change CultureInfo.CurrentCulture in CF

 
 
=?Utf-8?B?TGluYQ==?=
Guest
Posts: n/a
 
      3rd Mar 2004
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
 
Reply With Quote
 
 
 
 
Mark Johnson
Guest
Posts: n/a
 
      4th Mar 2004
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/A...orer/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 Removed)



"Lina" <(E-Mail Removed)> schrieb im Newsbeitrag
news:36B44D3A-3BF1-4A6D-83A1-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Daniel Moth
Guest
Posts: n/a
 
      4th Mar 2004
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" <(E-Mail Removed)> wrote in message
news:36B44D3A-3BF1-4A6D-83A1-(E-Mail Removed)...
> 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




 
Reply With Quote
 
Roman Batoukov [MS]
Guest
Posts: n/a
 
      17th Mar 2004
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==?=" <(E-Mail Removed)>
| Subject: how to change CultureInfo.CurrentCulture in CF
| Date: Wed, 3 Mar 2004 00:51:05 -0800
| Lines: 5
| Message-ID: <36B44D3A-3BF1-4A6D-83A1-(E-Mail Removed)>
| 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator[0]Index was outside the bounds of the array Roman Microsoft Dot NET Framework 2 31st Aug 2009 01:01 PM
How to change CurrentCulture? Serge Wautier Microsoft Dot NET Compact Framework 3 30th Sep 2008 11:36 AM
Now() Fucntion and CurrentCulture ra294 Microsoft Dot NET Framework 5 26th Nov 2004 08:51 AM
WebApplication - CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern--Not Working!! Muralidhar Chennoju Microsoft C# .NET 0 6th Oct 2004 05:28 PM
Regional Settings en-GB CultureInfo.CurrentCulture.Name = en-US magister Microsoft ASP .NET 7 17th Aug 2004 04:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:47 PM.