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.

cultureinfo
Filter by
Sorted by
Tagged with
0 votes
0 answers
96 views

Parse next century Date "27-Jun-2118" C# Try Parse

I want to parse this date "27-Jun-2118". I don't know why my code is not parsing this date. After looking around. I found out that it depends on Culture but I was unable to find out maximum date i can ...
Charlie's user avatar
  • 4,865
2 votes
1 answer
948 views

C# GetResourceSet can't find the default resource resx file

I try to load a specific resource set or the default resource set if the specific one is not found. Here is the code : ResourceSet resourceSet = MyLib.MyResource.ResourceManager.GetResourceSet( ...
G.Dealmeida's user avatar
0 votes
1 answer
2k views

Change thread culture .NET Framework 4.6 and later versions

I'm trying to change a new thread CultureInfo like the sample below but: Attempt1: SetCulture1() is not changing my thread Attempt2: SetCulture2() I got the exception "System....
idenardi's user avatar
  • 621
0 votes
1 answer
1k views

Excel vba converting date to different format when OS culture is set to UK

In Excel VBA I am assigning a hard coded date to a named range as below: Worksheets("Main").Range("Effectivedate").Value ="11/12/2018" This is been triggered on a button Click. Now I have my system ...
user2081126's user avatar
0 votes
1 answer
923 views

Getting CultureInfo from RegionInfo.TwoLetterISORegionName

In db I already have stored values with RegionInfo.TwoLetterISORegionName values. Atm I have values like 'be' for Belgium, 'no', 'gb', 'en' etc. If I write: var culture = new CultureInfo("be"); ...
petko_stankoski's user avatar
1 vote
1 answer
283 views

c# GetInstalledVoices in a certain language

I am able to get a list of all the voices installed on my Windows 10 system with: var voiceCollection = synthesizer.GetInstalledVoices(); and I can get a list of installed voices from a certain ...
GordonBooker's user avatar
1 vote
2 answers
1k views

DateTime.Parse throws FormatException regardless of CultureInfo

My machine is configured with European date format: dd/MM/yyyy When running any of the following lines: DateTime.Parse("11/15/2017 12:00:00 AM"); DateTime.Parse("11/15/2017 12:00:00 AM", CultureInfo....
Mugen's user avatar
  • 8,803
1 vote
1 answer
333 views

Make MVC Web application to use default resource file

I have an asp net MVC application that uses Resource files for translations. Some of these resource files are shared across a number of applications. Normally this works as expected: ProjectX - ...
Mystogan's user avatar
  • 547
0 votes
1 answer
71 views

HijriCalendar does not exist

I am trying to get the current Hijri date in my Xamarin app. I tried: Calendar hijri = new HijriCalendar(); and Calendar hijri = new HijriCalendar(); but getting: Error CS0246: The type or ...
Jassim Al Rahma's user avatar
0 votes
2 answers
119 views

Converting CultureInfo currency between Saudi Arabia & US

I have something like: price_2.Text = CDbl(price_2.Text).ToString("C", current_culture) Issue/Workflow: And lets assume the beginning price is in dollars so lets say price_2.Text is $5.99. And when ...
Omid CompSCI's user avatar
  • 1,891
1 vote
1 answer
396 views

C# Mysql cultureinfo.invariantculture

I have an double value in my insert request. I change the comma into a dot in this double value and have 12.5 instead of 12,5 when I create my MySqlCommand like in MySQL rules. But my string change my ...
MrB3NiT0's user avatar
  • 137
0 votes
2 answers
525 views

How to apply cultureinfo (language) property to WPF richtextbox selection

I usually can find solutions somewhere on the web, and mostly here at SO. I have tried for two days now to resolve this issue with all attempts yielding the very same results. Hopefully someone here ...
user3501495's user avatar
2 votes
0 answers
71 views

How to add custom currency pattern in culture?

I have to add my custom pattern to my custom culture (CultureInfo). There is a list of all patterns but I didn't find one I need: "n- " So the question is how to add my custom pattern to culture? I ...
TimKah's user avatar
  • 41
0 votes
1 answer
483 views

How to get the country code using country name

I want to be able to get country code using country name. As of now I'm doing this: var regions = CultureInfo.GetCultures(CultureTypes.SpecificCultures) .Select(x => new ...
coders's user avatar
  • 721
0 votes
0 answers
26 views

the translation of the data is not valid

the datatable should send me the following data (Compte sociétaire) but it sends me back (Compte socié\u0082taire), what do I miss in my code to have the correct formatting? Req = "select lib as ...
dudu's user avatar
  • 1
12 votes
1 answer
3k views

ASP.NET MVC (Async) CurrentCulture is not shared between Controller and View

I have an ASP.NET MVC 4 application that is targeting .NET Framework 4.7.1, with the problem that the culture is not shared between Controller and View, if the action contains async calls. I am ...
Ionut-Stefan Dinu's user avatar
2 votes
1 answer
376 views

How to split culture specific strings

I need to split the following string into string[]. string tempstring = "د.ع.‏123,456.00";// culture "ku-Arab-IQ" string[] temp = tempstring.Split(".".ToCharArray()); But I am getting the following ...
Venkat's user avatar
  • 2,569
3 votes
0 answers
298 views

How to deal with expressions from another culture using Datatable/Datacolumn

I have some code in my codebase that evaluates an expression that gets passed to it using the Datatable method because [insert historical reasons here]. A short version of the method is below. When ...
dylanT's user avatar
  • 1,090
1 vote
2 answers
383 views

Why would GetCultureInfo() format differently on different servers?

I'm working with two servers (Server 2012 Std) and (Server 2016). On 2012 when I run the command: [System.DateTime]::UtcNow.ToString([System.Globalization.CultureInfo]::GetCultureInfo("en-NZ")) I ...
Jake Nelson's user avatar
  • 1,888
1 vote
0 answers
50 views

Will OS Locale/ Language Culture affect casting?

I am trying to cast a numeric field (in db) to a decimal (in .net). I am using .Field extension method. var data = myDataTable.AsEnumerable().Select(val => new clsValues() { ...
arc's user avatar
  • 11
1 vote
1 answer
1k views

String was not recognised as valid datetime for arabic language

I'm using below code for convert string to datetime(with slected language). It works well for all other language except Arabic. When passing ar as CultureInfo it throws an error "String was not ...
nsds's user avatar
  • 971
0 votes
1 answer
469 views

Windows Culture Settings: apostrophe vs right single quotation mark

All of a sudden, some test turned red on my machine and failed with the message: Input string was not in a correct format. These tests take a bunch of numbers and strings and compare them with a ...
Waescher's user avatar
  • 5,569
2 votes
1 answer
354 views

Getting two different values for CurrentCulture in same solution

I have multiple projects in my solution: I have a WebApi project named "Api" that has a reference to a class library named "Models". I am setting the globalization information in my web config like ...
Susana Castela's user avatar
2 votes
1 answer
53 views

MVC DateTime Not Converting

I want them all DateTime format to be this way: MM/dd/yyyy HH:mm:ss I try this: DateTime time= aModel.time; //{13.01.2018 08:30:00} string formatcurrenttime = String.Format("{0:MM/dd/yy HH:mm:ss}", ...
Geomatik Mühendisi's user avatar
1 vote
0 answers
85 views

Timestamp in log changed cultureformat from 24h to 12h during runtime

I'm writing this question in the hope that you could lead me in the right direction regarding our current logging timestamp (on some servers). During a deployment session we noticed that the ...
Rane Balslev's user avatar
4 votes
2 answers
1k views

Setting StringFormat for all DateTime objects globally independent of CultureInfo - WPF

Is there any way to set the StringFormat for all DateTime objects globally independently of the CultureInfo in my WPF Application? I use bindings to this kind of objects from the whole application, ...
chincheta73's user avatar
1 vote
2 answers
778 views

ToString(CultureInfo.CurrentCulture) Is this needed?

I'm working on an Api and all of the strings have ?.ToString(CultureInfo.CurrentCulture) What is this doing and is it needed? What about the other data types such as int or decimal?
Jason's user avatar
  • 113
2 votes
0 answers
71 views

Impossible to visualize display language with vb.net

I currently make a program in vb.net which needs to know what is the DISPLAY language in windows. I try to visualize it using : CultureInfo.CurrentCulture.Name But when I use it, the value equals ...
Bally Mathieu's user avatar
1 vote
1 answer
217 views

DateTime.Now.ToUniversalTime().GetDateTimeFormats() returns an array with different number of elements on Windows 7 and Windows 10

DateTime.Now.ToUniversalTime().GetDateTimeFormats() When I run the above C# code on Windows 7, it returns an array with 133 elements, however, when the same code is executed on Windows 10, it returns ...
Ankit Gupta's user avatar
0 votes
0 answers
37 views

One app uses comma one uses full-stop/period for double values after publish

I have 2 ASP MVC applicataions sitting on the same server, in different app pools. One is public facing and the other is just for users of the internal network. They both query the same database and ...
Bassie's user avatar
  • 9,990
3 votes
3 answers
3k views

How do I use CultureInfo to get the 12-hour or 24-hour time (without the date)

I would like to use C# to format a time of day in the proper cultural format. For example, if the current culture is en-US I would like to show 1:00 PM, and if the current culture is fr-FR I would ...
ORcoder's user avatar
  • 252
1 vote
4 answers
7k views

How to display the euro symbol at the front of the number when using CultureInfo?

So I wanted to try display currency in C# and found CultureInfo, only thing is, there is no way to display the euro symbol at the front of the number, not from what I have seen and read. Basically ...
JazzEX's user avatar
  • 129
0 votes
1 answer
1k views

Converting character code to character C# using CultureInfo

I'm using Arabic CultureInfo in a C# project. At one place I'm converting the character code to character using Strings.Chr(chrCode) if the language which I select is English it is working fine, other ...
Abhishek Hotte's user avatar
0 votes
1 answer
1k views

Where should I change/set culture info settings in my WPF app and why? (Must works on all .NET frameworks 4.0 and newer)

I'm trying to set up an a culture info for my WPF application and I've found several examples, like: CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); CultureInfo....
billy_56's user avatar
  • 669
11 votes
4 answers
21k views

Convert number into culture specific

I have a number like 202667.4. I want to convert this to number based on culture. For Ex: In "de"(German) the number should be in 202.667,40. Any help will be greatly appreciated. Thanks.
Manikandan Ram's user avatar
1 vote
0 answers
55 views

Can't get correct localized language file from within added class (C# ASP.NET)

C# ASP.NET I have 3 files that contain different language strings (LocalizedText.resx, LocalizedText.de.resx and LocalizedText.en.resx). I'm able to change the CultureInfo dynamically in my project ...
user3888775's user avatar
1 vote
2 answers
558 views

Normalize a string which contains a decimal to specific CultureInfo.NumberFormat

I'm struggling trying to normalize a number to an specific CultureInfo, applying its NumberFormat Let's say I have a string which also contains some characters, so I need to clean it up: var ...
Gonzo345's user avatar
  • 1,215
7 votes
2 answers
4k views

How to create .NET CultureInfo with Dateformat ISO 8601?

Is it possible to make .NET create the following output? DateTime.UtcNow.ToString() --> "2017-11-07T00:40:00.123456Z" Of course there is always the possibility to use ToString("s") or ToString("...
Andreas's user avatar
  • 2,035
2 votes
1 answer
748 views

first and lastname order based on culture [closed]

So, from my understanding, most Asian cultures have family names before given names. Say I have string firstName = "Andy" string surName = "Peterson" based on the locale, I want to present his name ...
Liselej's user avatar
  • 23
6 votes
1 answer
2k views

Why is CurrentUICulture "DE-DE" even though I have set up "DE-CH" in Windows

In my WPF application the CurrentUICulture is not properly taken over by Windows or is wrongly stored in Windows. The region and language settings in Windows are in all places that I have found "...
Adrian's user avatar
  • 111
1 vote
1 answer
109 views

C# Double division returning infinity when is not supposed to

I have this code on a Entry completion event: (Xamarin) if (double.TryParse(txt_MinRate.Text, out double i)) { if (i < 0.0 || i > 6.0) { if (i > 6.0) { ...
rickrvo's user avatar
  • 535
9 votes
3 answers
11k views

Difference between Convert.ToDouble and double.Parse in correlation with InvariantCulture

I am wondering why this is working: doubleValue = double.Parse(input[0].ToString(System.Globalization.CultureInfo.InvariantCulture).Replace(',', '.'), System.Globalization.CultureInfo....
Essigwurst's user avatar
1 vote
1 answer
99 views

Are there cultures in which the decimal separator is longer than one character?

I must write a stringToNumber parsing function that can use custom strings for the following: decimal separator (. for en-US => 3.1415) thousands separator (, for en-US => 1,000,000) positive sign (+ ...
Krisztián Balla's user avatar
0 votes
2 answers
740 views

C# Check if string is in a value format

I'm wondering if there's simple way to check if a string is in a value format of any kind. Meaning the number one-thousand could be represented in any of the following ways: 1000 1000.00 1,000 1,...
Joe Higley's user avatar
  • 1,792
2 votes
0 answers
645 views

How do I get Assembly.GetManifestResourceStream to return localized resource?

I have added three embedded files to my C# assembly Resources\ErrorMessages.de_DE.json Resources\ErrorMessages.en_US.json Resources\ErrorMessages.json When I call this: Assembly....
4thex's user avatar
  • 1,154
12 votes
2 answers
6k views

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/...
bradgonesurfing's user avatar
3 votes
1 answer
2k views

CultureInfo.Name Property

Reading from MSDN CultureInfo.Name Property Gets the culture name in the format languagecode2-country/regioncode2. Then the example: Console.Write("{0,-7}", ci.Name); [...] /* This code ...
serge's user avatar
  • 14.6k
0 votes
1 answer
249 views

Input tag ,CultureInfo and Html (French vs English)

My question is for input tags and when the type is a number Say I had a number French <input type="number" value="3,4"> English <input type="number" value="3.4"> Notice how the page ...
Yusuf Jama's user avatar
2 votes
1 answer
150 views

How can I prevent a DateTime from getting serialized in XML with culture information?

I am trying to retrieve my data from CRM. But while doing that, it looks like it is applying culture to datetime field. I have saved the datetime in CRM as - 01/08/2017 12:00 AM. But when I ...
omkar patade's user avatar
  • 1,471
0 votes
0 answers
581 views

C# Windows Service not using Regional Settings info

I have a .exe file which will generate date in MM/DD/YY if I set short date format in Regional Settings as DD/MM/YY. So when I execute the .exe manually, I get correct output. But when I use C# ...
Rauf's user avatar
  • 12.6k

1
4 5
6
7 8
24