cultureinfo

How to set CurrencySymbol on Readonly CultureInfo.NumberFormat ?

I'm trying to format a currency (Swiss Frank -- de-CH) with a symbol (CHF) that is different that what the default .Net culture is (SFr.). The problem is that the NumberFormat for the culture is ReadOnly. Is there a simple way to solve this problem using CultureInfo and NumberFormat? Is there some way I can override the CurrencySymbol? ...

.NET Custom CultureInfo localization

I spend hours and hours tried to figure this out why my ResourceManager won't pickup my Resource file? Background: I create a custom CultureAndRegionInfoBuilder with code "km-KH" it registered without any problem. Add resource files Messages.resx; Messages.km-KH.resx & Messages.fr-FR.resx with key hello of value "Hello", "Soursdey" & ...

CA1305: int.Parse(String)

I am getting a CA1305 Warning. Microsoft.Globalization : Because the behavior of 'int.Parse(string)' could vary based on the current user's locale settings, replace this call in '_Default.CalculateImageButton_Click(object, ImageClickEventArgs)' with a call to 'int.Parse(string, IFormatProvider)'. If the result of 'int...

Why isn't CultureInfo.NativeName always capitalized?

Just out of curiousity... In our application I list all the available translations in the following format "NativeName - EnglishName". For some languages the NativeName isn't capitalized eg. "Deutsch - German" "español - Spanish" "français - French" "italiano - Italian" "Nederlands - Dutch" "polski - Polish" It's no big deal to capit...

Change ASP.NET default Culture for date formatting

For some reason, ASP.NET code on my server is now returning a format of dd/MM/yyyy instead of MM/dd/yyyy when I use DateTime.ToString("g"). Rather than replacing all the "g" format strings with a concrete format string or CultureInfo argument, is there a way I can just override, across the application, the default "short date" format? ...

overiding NumberFormat in .net application cultureInfo

I have a .NET application available in several different language. i basically load and save file (containing doubles) in the System Culture but i would like to force numbers to always be displayed and entered using the US culture format (comma as digit grouping, period as decimal separator). I tried to override the application Culture ...

Does DateTime.ToString("s") return always same format?

According to MSDN on DateTime.ToString ToString("s") should always return string in the format of the sortable XML Schema style formatting, e.g.: 2008-10-01T17:04:32.0000000 In Reflector I came to this pattern inside DateTimeFormatInfo. public string SortableDateTimePattern { get { return "yyyy'-'MM'-'dd'T'HH'...

new CultureInfo(string Name) constructor - .NET (C#)

Hi, I have a situation where I save a string representation of dates/numbers etc in the DB, and since the application is run in multiple countries and sometimes with users in different countries using the same DB, I store the CurrentCulture.Name in the DB with the record so that when converting on the client side, it converts using the ...

Mysterious Resources /CultureInfo behaviour in WPF App

i have two Resources files in the Properties folder of a WPF-project (VS 2008): Resources.resx Resources.de-DE.resx Selecting the culture "de-DE" does not work (no error, but always the strings from "Resources.resx" are used): public App() { UntitledProject2.Properties.Resources.Culture = new CultureInfo("de-DE"); } ...

CultureInfo & DateTimeInfo: How to check if is 24 hour time?

I'm modifying a globalized web application which uses stored CultureInfo for each logged in user. The client would like time data entry to be localized. Displaying is not a problem as the formatting is already available. However I need to detect if the current cultureinfo is for 24 hour time or am/pm so I can display the correct input ...

Checking Mobile Device Culture Info From The Desktop

I'm looking for a way to check the culture settings on a windows mobile device from a desktop application. Is there an easyway to do this? Basically I want to do something like: MobileDevice.CultureInfo.CurrentCulture.Name ...

Custom Culture info in ASP.NET

Hi all, I created a CustomCulture class form CultureInfo. Here is my code: public class CustomCulture : CultureInfo { private string _parent; private string _name; private string _description; public CustomCulture(string parentCulture, string myCultureName) : base(parentCulture) { _parent ...

Windows IE Regional Configuration and ASP.NET

I'm currently playing with an issue in the format of currency values across an ASP.NET application. I've set up my webconfig to detect automatically the client culture and I manage as it's desired from the app. I have to show the values formatted depending on his regional config. My question is if the Regional Configuration within contr...

Forcing a culture on an application

How can I force and application and any threads that are started by that application to run under a specific culture? I have tried the following but I still get exceptions in English. My understanding was that the wording on exceptions are translated using the active culture. static void Main(string[] args) { Thread.C...

How to get timezone from properties in CultureInfo

I have a string, which contains a timestamp (yyyy-mm-dd hh:mm:ss). I can create a CultureInfo object based on other information I get. Therefore I know which country the timestamp is in. The timestamp is not in UTC/GMT. Say the timestamp is from Indonesia (new CultureInfo("id-ID")), meaning the string was created by DateTime.Now.ToStrin...

Format string by CultureInfo

Hi I want to show pound sign and the format 0.00 i.e £45.00, £4.10 . I am using the following statement: <td style="text-align:center"><%# Convert.ToString(Convert.ToSingle(Eval("tourOurPrice")) / Convert.ToInt32(Eval("noOfTickets")), new System.Globalization.CultureInfo("en-GB")) %></td> But it is not working. What is the problem. ...

Why doesn't DateTime.ToShortTimeString() respect the Short Time format in "Regional and Language Settings"?

I have run into an issue that is probably due to my mis-understanding of how the DateTime.ToShortTimeString() method works. When formatting time strings with this function, I was assuming that it would respect the "Short Time" setting in Windows 7's Format settings Control Panel -> Clock, Language and Region -> Region and Language -> Fo...

Changing Thread.CurrentThread.CurrentCulture on a ASHX Handler

Hi, I want to change the language in my website. I thought i could do it using a Handler, so the drop down would go for http://domain.com/Handler.ashx?language=en-US, f.i. So, it calls the handler, that has this code: string selectedLanguage = context.Request.QueryString["language"]; Thread.CurrentThread.CurrentCulture = CultureI...

ASP.NET Globalization: Culture="auto" page directive with neutral culture crash?

Hi all, I'm running into a case where an ASP.NET application using the built-in globalization facilities is crashing. On an ASP.NET page with the Culture="auto" directive, a user with a neutral culture as their browser language (such as "zh-Hans") will produce the following exception: Culture 'zh-Hans' is a neutral culture. It can...

VS C# CultureInfo set permanently to value within the IDE?

I've got a German VisualStudio 9.0. Working with doubles and doing quite some parsing, I came into trouble because of the decimal separator. What I'm looking for is a way to either switch the whole IDE (and therefore all the projects created with it) to "en-gb" or do it project wide. I chose en-gb because of the lack of am's and pm's w...