cultureinfo

Refactoring two basic classes

How would you refactor these two classes to abstract out the similarities? An abstract class? Simple inheritance? What would the refactored class(es) look like? public class LanguageCode { /// <summary> /// Get the lowercase two-character ISO 639-1 language code. /// </summary> public readonly string Value; public L...

What is the difference between CurrentCulture and CurrentUICulture properties of CultureInfo in .NET?

In .NET there is the CultureInfo class in the System.Globalization namespace. It has two similar properties both returning values of the CultureInfo type: CurrentCulture and CurrentUICulture. What is the difference between them? Which one should I use when and why? ...

Convert text from English characters to Hebrew characters

Using C#, when a user types a text in a normal textbox, how can you see the Hebrew equivalent of that text? I want to use this feature on a data entry form, when the secretary puts in the customer name using English characters to have it converted automatically in another textbox to the hebrew representation. Maybe something with Cultu...

ASP.NET - Negative numbers in Parenthesis

Hi, My application is currently displaying negative numbers as -1. The users have changed the requirements (just for a change!) and now we will have to display the numbers as (1). Can I enable that for the whole application say changing the web.config or even the app's CultureInfo ? Is there any side effect of doing that since we have l...

What will happen if I set CurrentCultureInfo to en-us

I am using a client application which connects to a remote Database in US. there are some datetime ambiguities that comes up in the result like if date is 14 Jan in database its returned as 13 Jan. What I would like to know If I Set the CurrentCultureInfo of my Client equal to my Servers will that solve the issue. If this can be done....

Compact Framework - Retrieve a list of countries and regions

Afternoon people! I'm trying to implement a list of counties on my Compact Framework (Mobile) application. I can do this easily in the full .Net framework with CultureInfo.GetCultures(..etc). However, the CF seems to be missing this feature? Is there any way I can return a list of countries (and regions if possible) that I can populat...

Looking for String operations edge cases. What do I need to test?

I am getting to the last stage of my rope (a more scalable version of String) implementation. Obviously, I want all operations to give the same result as the operations on Strings whenever possible. Doing this for ordinal operations is pretty simple, but I am worried about implementing culture-sensitive operations correctly. Especially...

C#: Setting CurrentCulture and CurrentUICulture of an application

Is there a way of setting culture for a whole application? All current threads and new threads? We have the name of the culture stored in a database, and when our application starts, we do CultureInfo ci = new CultureInfo(theCultureString); Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci; But, of...

Browser language: autodetect vs user select?

Hi, I am designing a localized web app. I am leaning on auto-detect browser language setting. But I notice a number of respectable sites asking the user to select a language. Is there any usability issue you know of (from actual experiences out there) with just auto-detecting user language? Thanks. ...

Programmatic way to get all the available languages (in satellite assemblies)

I'm designing a multilingual application using .resx files. I have a few files like GlobalStrings.resx, GlobalStrings.es.resx, GlobalStrings.en.resx, etc. When I want to use this, I just need to set Thread.CurrentThread.CurrentCulture. The problem: I have a combobox with all the available languages, but I'm loading this manually: comb...

c# and Date Culture Problems

I've written a asp.net app and one of my postback routines simply saves user submitted form data to a sql 2005 db. All runs great on my development machine but when I deploy to the live site I'm getting invalid dates from my parse date checker. Basically it is expecting an american date format on the live machine but this is not what I...

How can I (an American) test whether my ASP.NET/SQL Server app is handling decimals correctly for Germany.

In the US, you use a "." as the separator, but in Germany you use a ",". I'm trying to test whether my logic is smart enough to handle either one but I seem to be failing to put my Windows 2000 machine into German mode. I went to Control Panel, Regional Options, and changed "Your locale" to "Germany". I then restarted both IIS and SQ...

Double.Parse - Internationalization problem

This is driving me crazy. I have the following string in a ASP.NET 2.0 WebForm Page string s = "0.009"; Simple enough. Now, if my culture is Spanish - which is "es-ES" - and I try to convert the string to Double, I do the following: double d = Double.Parse(s, new CultureInfo("es-ES")); what I'd expect is 0,009. Instead, I get 9. I ...

Currency format string in asp.net

Hi, I am using an infragistics webgrid and need to format a currency string. For this I need a string containing a pattern such as "$ ### ###,00" and I would like this to come out of my current CultureInfo. How can I do this? Do I need to compose it manually from the info in: CultureInfo.CreateSpecificCulture(myLanguageId).NumberFormat...

Best Practice - Format Multiple Currencies

What is best practice for the scenario listed below? We have an application which we would like to support multiple currencies. The software will respect the users locale and regional settings to dictate the correct number format, i.e. $10,000.00 or 10.000,00₴ etc. We would however like to be able to format different numbers based upon...

How to get current country-code/locale in XSL?

I am using XSL transform on XML. Some part of transform are dependent on current locale. Is there any way to find the current locale from within XSL? For example, the user-visible serialization of a floating point number can vary between locales ("1.0" in English is "1,0" in German), and my transform needs to take differences like these...

Setting CultureInfo on wcf service calls?

I have a WCF service running that needs to parse some data. It turns out that data (points, sizes) gets converted differently in different CultureInfo's and the parsing is spread out in a lot of classes and methods. Since all the parsing is done without passing any CultureInfo the success of the parsing is dependant of the threads cultur...

Sort Japanese Text using "aiueo" order

Hi I am trying to sort some Japanese shop names using the "aiueo" order Does anyone know if there is an algorithm to do this I have written a comparer as follows but I believe the ja-jp culture uses the Unicode sort internal class JewellerComparer : IComparer<string> { private readonly string _culture; public Jew...

Determine local culture of a PC without creating an application

Hi, Is there any way to determine the local culture of a PC (such as en-US) without running an application? I tried looking in Control Panel | Regional Settings (running WinXP), but I don't know how the choices there map to the PC's culture. I'm looking for a solution that doesn't require creating an .exe, such as running a command fr...

Is setting CultureInfo in a intranet, ASP.NET, single server app a waste of time?

I'm looking at 1000s of code setting the CultureInfo for ToString and number conversions and date usages. The application is only used on one server, in one town, by one monolingual office and isn't going to move to another country ever. I think these got there from following misplaced FxCop advice about internationalization. Is there...