Questions tagged [culture]

Culture is the combination of language and peculiarities of geographical location (like en-UK, en-US, de-AT, de-DE, fr-BE)

Culture is the combination of language and peculiarities of geographical location (like en-GB, en-US, de-AT, de-DE, fr-BE)

815 questions
32
votes
4 answers

Is CultureInfo.CurrentCulture really necessary in String.Format()?

How do you think is really necessary to provide IFormatProvider in method String.Format(string, object) ? Is it better to write full variant String.Format(CultureInfo.CurrentCulture, "String is {0}", str); or just String.Format("String is {0}",…
abatishchev
  • 98,240
  • 88
  • 296
  • 433
32
votes
10 answers

CurrentCulture incorrectly defaulting to en-US in ASP.net

I have just migrated around 100 ASP.net sites from IIS 6 on Windows Sever 2003 to IIS 7 on Windows 2008. I've just noticed that various pieces of code that use things like DateTime.Parse have started kicking up errors "String was not recognized as a…
Siegemos
  • 385
  • 1
  • 3
  • 10
30
votes
2 answers

culture invariant object ToString()

How can I call ToString() on an object and make it use the invariant culture? There are overloads for ToString() on objects that implement IConvertible (like bool, int, float..), but what if the object in question is not IConvertible?
codymanix
  • 28,510
  • 21
  • 92
  • 151
29
votes
2 answers

Java equivalent of Invariant Culture

I am converting the following C# code to Java. Is there a Java equivalent to the .NET concept of Invariant Culture? string upper = myString.ToUpperInvariant(); Since the Invariant Culture is really just the US culture, I could just do something…
Josh Clark
  • 625
  • 2
  • 9
  • 12
27
votes
2 answers

C#- ToLower() is sometimes removing dot from the letter "I"

We have noticed a weird error when calling ToLower() on certain strings. The input string is: string s = "DocumentInfo"; string t = s.ToLower(); // sometimes, t == documentinfo // other times, t == documentınfo (note dot is missing from i -…
frankadelic
  • 20,543
  • 37
  • 111
  • 164
27
votes
4 answers

Is it possible to set the CultureInfo for an .NET application or just a thread?

I've an application written in C# which has no GUI or UI, but instead writes files that are parsed by another application (in XML and others). I have a customer whose CultureInfo has the NumberDecimalSeparator set to a comma, which causes parsing…
NVRAM
  • 6,947
  • 10
  • 41
  • 44
25
votes
3 answers

How to change CurrentCulture at runtime?

I need to change cultures at runtime according to resource files for each culture. I need to change the attributes of the controls in my form, according to two cultures which have designated .resx files resorces1.aspx.resx // default…
eran otzap
  • 12,293
  • 20
  • 84
  • 139
24
votes
4 answers

In .Net: best way for keeping CurrentCulture on new Thread?

In a .Net 4.0 WPF project, we need to keep the same CurrentCulture on each thread then we have on the main thread. Given, we can initialize a new thread's culture with code like the following: Keep the information in a variable…
PBelanger
  • 1,269
  • 1
  • 13
  • 24
23
votes
2 answers

Output cache for multi-tenant application, varying by hostname and culture

I have a multi-tenant application in ASP.NET MVC. The instance of the application that will be served is function of the hostname alone (something along the lines of stackexchange, I suppose). Each instance of the application might have a different…
Bruno Reis
  • 37,201
  • 11
  • 119
  • 156
22
votes
2 answers

When should I specify CurrentCulture or InvariantCulture and when should I leave it unspecified?

What is the best practice for specifying CurrentCulture or InvariantCulture and not specifying the culture at all? From what I have read, if you're doing serialization, for instance, you need InvariantCulture as a means of specifying a canonical…
Scott Stafford
  • 43,764
  • 28
  • 129
  • 177
19
votes
6 answers

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 =…
oz.
  • 2,153
  • 3
  • 16
  • 15
19
votes
3 answers

is StringComparison.Ordinal the same as InvariantCulture for testing equality?

From their brief summary descriptions, it sounds like the string comparison rules StringComparison.Ordinal and StringComparison.InvariantCulture are meant to differ in how they do sorting of strings. Is that all? i.e., does that mean we can use…
Tim Lovell-Smith
  • 15,310
  • 14
  • 76
  • 93
19
votes
6 answers

C# BackgroundWorker's culture

I woudl like to set the culture for my whole application. I tried the following : Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(wantedCulture); Thread.CurrentThread.CurrentUICulture =…
Toto
  • 7,491
  • 18
  • 50
  • 72
18
votes
3 answers

Get CultureInfo object from country name or RegionInfo object

Given a specific country code, e.g. "CH", how can I get a CultureInfo object? The specific country code is dynamic (changes at runtime). I only have the country code, and i want to know if it is possible to create a CultureInfo object from just the…
Ben
  • 511
  • 2
  • 6
  • 18
18
votes
5 answers

How to force English keyboard in android EditText

I know how to force numbers, texts etc.., but is there a flag or IME options for me to force the EditText to accept only certain language like English in case my DB fields can accept only English characters? of course I can check and notify the…
codeScriber
  • 4,582
  • 7
  • 38
  • 62
1
2
3
54 55