Questions tagged [cultureinfo]

Represents information about a specific culture including the names of the culture, the writing system, and the calendar used, as well as access to culture-specific objects that provide information for common operations, such as formatting dates and sorting strings.

Represents information about a specific culture including the names of the culture, the writing system, and the calendar used, as well as access to culture-specific objects that provide information for common operations, such as formatting dates and sorting strings.

Reference

CultureInfo on MSDN

1135 questions
15
votes
1 answer

.Net CultureInfo Month Names returning an extra empty string

I have the following code to get a list of Month names: var monthNames = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames; For some reason, this keeps returning an additional empty string value along with the Month…
pnavk
  • 4,552
  • 2
  • 19
  • 43
15
votes
3 answers

Why not all countries are presented in CultureInfo.GetCultures()?

I am using this standard code for populating list of countries: static void Main(string[] args) { List cultureList = new List(); CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures); …
sashaeve
  • 9,387
  • 10
  • 48
  • 61
14
votes
1 answer

Why do commas behave differently in int.Parse() and decimal.Parse() with InvariantCulture?

Why does: decimal.Parse("1,2,3,45", CultureInfo.InvariantCulture) return a decimal of 12345, yet: int.Parse("1,2,3,45", CultureInfo.InvariantCulture) throws an exception? I would expect the commas to be treated the same for the same culture. If…
Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
13
votes
7 answers

How to convert "12,4" to decimal en-Us culture

I have a decimal value ("133,3") stored in string column in the database, in norway culture. after that user changed the regional setting to english-Us. when I convert "133,3" to decimal using CultureInfo.InvariantCulture, getting invalid value or…
Anand Kumar
  • 395
  • 2
  • 7
  • 18
13
votes
5 answers

Change Language in C#

I am developing a multilingual program in C# on Windows How to change Windows writing language on certain actions... e.g. to change from English to Arabic on focus event. Thanks
Betamoo
  • 14,964
  • 25
  • 75
  • 109
13
votes
1 answer

Culture-Invariant case-sensitive string comparison returns different results on different machines

I've found that the test results are different on my machine and the build server. I've managed to find the single line that differs. This is a string comparison. The two strings differ in case of the first character. The test below passes on my…
filhit
  • 2,084
  • 1
  • 21
  • 34
13
votes
1 answer

What is the best way to compare two CultureInfo instances?

Background: I have a problem with a component, which changes the current thread culture to "en-US" every time after a call to a specific method of it. Further in my process that leads to problems, e.g. the data access layer is no more working…
Kr15
  • 595
  • 1
  • 6
  • 22
13
votes
2 answers

Why do I get, "Culture is not supported" and What, if Anything, Should I Do about it?

I have a breakpoint on the "return" line here: [HttpGet] [Route("api/Test/{id1}/{id2}")] public NRBQEntity GetTestMessage(String id1, String id2) { return NRBQClient.GetTestMessage(id1, id2); } Although it does not crash the app, when I reach…
13
votes
8 answers

How can i convert English digits to Arabic digits?

I have this C# code for example DateTime.Now.ToString("MMMM dd, yyyy"); Now the current thread is loading the Arabic culture. So the result is like this ???? 19, 2010 But i don't want the '2010' and the '19' to be in English (also known as Latin…
LolaRun
  • 5,526
  • 6
  • 33
  • 45
13
votes
4 answers

What cultures are supported by the CultureInfo class in .NET 3.5?

I need a list of cultures that are supported by .NET 3.5, regardless of the OS used. This seems to be quite a struggle to obtain, though I am not sure why! Edit: Arghh, I was not aware that it is dependent on the OS, that would explain the lack of…
13
votes
1 answer

format number with 3 trailing decimal places, a decimal thousands separator, and commas after that

This is probably a simple question, and I'm sure there's a way to do it with string.format(), NumberFormatInfo, CultureInfo or some combination of them, but I need to display large numeric values with 3 trailing decimal places, a decimal instead of…
Brett
  • 1,267
  • 1
  • 13
  • 21
13
votes
3 answers

creating custom CultureInfo for country, language combination

I am working on a .net 4.5 application that needs to be mult lingual supporting multi cultures etc. The following is sample list of Countries/Languages Russia / Russian Belgium / French Belgium / Dutch For all the above, there is a CultureInfo…
amateur
  • 43,371
  • 65
  • 192
  • 320
12
votes
1 answer

How to make a dropdown list of all cultures (but no repeats)

I'm trying to make 2 dropdown lists. The top one offers all cultures, (but no repeats). Example: English, Spanish, Filipino After selecting from the top list the bottom list will show any specific types. I right now I use this code for my top…
aron
  • 2,856
  • 11
  • 49
  • 79
12
votes
4 answers

Get language name from locale string using .NET? ex: en_us => english

How can i find the language for a given locale? Example: input: en_US output: English Using the .NET libraries? I tried the CultureInfo class, but i can't find something usefull. Thanks!
ThdK
  • 9,916
  • 23
  • 74
  • 101
12
votes
2 answers

How to set the culture in a dotnetcore xunit test

I have the following unit test that I'm porting from a .Net Framework library to .Net core xunint test library. The project the unit test needs to be added to is https://github.com/dotliquid/dotliquid and is being added to the selected file as show…
bradgonesurfing
  • 30,949
  • 17
  • 114
  • 217