Questions tagged [regioninfo]

34 questions
1
vote
1 answer

Does .net have an inbuilt way of validating region names before creating a RegionInfo object?

My code looks like this: var twoLetterCountryCode = *Get possibly invalid value from database*; if (!string.IsNullOrEmpty(twoLetterCountryCode) && twoLetterCountryCode.Length == 2) { try { var region = new…
Aml
  • 15
  • 4
1
vote
0 answers

Culture is not supported (WPF)

Within a WPF App (.NET Framework 4.5.2) I use an IValueConverter to get the RegionInfo from a 2 letter region code: public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { // // we use…
1
vote
1 answer

Why does RegionInfo.TwoLetterISORegionName return 3 chars for Caribbean?

Trying to generate currency type seed data for an application and iterating through the CultureInfo collection of System.Globalization. I kept getting truncation errors on my insert statements until I discovered that when Caribbean comes up (listed…
D.Forrest
  • 845
  • 1
  • 9
  • 23
1
vote
0 answers

Using CultureAndRegionInfoBuilder to register newer cultures to older Windows versions

tl;dr: Is it possible to define and register en-BS as a culture on Windows Server 2012 R2? I'm trying to introduce international currency options to some software I'm working on. That process by itself has not been difficult. I use a culture code…
1
vote
1 answer

RegionInfo serializing in ElasticSearch

It seems that the RegionInfo object has kinda been forgotten in terms of serialization. CultureInfo works great and is serialized to and from a string. When attempting to throw in a RegionInfo object, I get a mess of all the properties of RegionInfo…
Cory-G
  • 1,025
  • 14
  • 26
1
vote
1 answer

RegionInfo: DisplayName translated by CurrentUICulture

Is there a way to get RegionInfo translated by a custom CultureInfo? I tried the following but it does not work: /* Change culture of current thread to german*/ CultureInfo de = new CultureInfo("de"); Thread.CurrentThread.CurrentCulture =…
Tobias
  • 2,945
  • 5
  • 41
  • 59
0
votes
0 answers

RegionInfo all properties populated with ISO code in Blazor

any ideas why in Blazor when I try to get user country name from RegionInfo all properties have the ISO code assigned? ///User.Country = "DE" RegionInfo region = new RegionInfo(User.Country); _country = region.EnglishName;
Avalari
  • 37
  • 1
  • 5
0
votes
0 answers

How can I get a CultureInfo or RegionInfo from United Nations M49 Country code in C#?

I want to create the ISO code from the UN M49 code which I receive from database. How can I do that in c#? ex: Sweden's UN M49 code is 752. How can I convert it to something like Sweden or Iso code "sv" I try to create CultureInfo and RegionInfo…
Quang Pho
  • 1
  • 1
0
votes
0 answers

C# - Get ISO 639-2 three-letter code from language name and country name

The problem I've got the following information: Language name Country An example would be: English, United States This information needs to be converted into an ISO 639-2 three-letter code. It might be good to know that I'm using dotnet 6 with C#…
ShadowDragon
  • 2,238
  • 5
  • 20
  • 32
0
votes
1 answer

RegionInfo and GeoId

I was thinking of using RegionInfo.TwoLetterISORegionName to as a database attribute from which to get information about a country. Until I saw RegionInfoGeoId, which seems more robust. Which would you store to support internationalization? How…
Berryl
  • 12,471
  • 22
  • 98
  • 182
0
votes
1 answer

Get list of possible country codes from BCP-47 code using System.Globalization

I'm trying to guess which country a BCP-47 code belongs to. I'm aware that this would provide a list of multiple countries. Nevertheless, I would like to try. Is that possible using any of the classes within System.Globalization? Why I'm doing this:…
HelloWorld
  • 3,381
  • 5
  • 32
  • 58
0
votes
1 answer

Converting country names into thier own ThreeLetterISORegionName with RegionInfo (c# 2013 Winforms)

I’ve already written every country’s name in a ComboBox but now i want to get each country’s ThreeLetterISORegionName when i click the country’s name in the ComboBox and display it in a label, is that possible? Thanks
simon
  • 19
  • 4
0
votes
1 answer

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"); instead of Belgium, I get Belarus. So I need a way to…
petko_stankoski
  • 10,459
  • 41
  • 127
  • 231
0
votes
1 answer

Am I understanding Region Info correctly?

So I don't necessarily need geocoding permissions, I don't care what the users city or location is, I just want to get the users country, or even continent. I found this guy in Xamarin documentation System.Globalization.RegionInfo Which when I test…
jdmdevdotnet
  • 1
  • 2
  • 19
  • 50
0
votes
0 answers

How to print Indian Currency symbol in pdf?

I can show the symbol in a messagebox, but it will not display in a PdfPCell. I want to use the currency symbol in a billing system. RegionInfo myRg = new RegionInfo("IN"); PdfPTable table = new PdfPTable(1); PdfPCell n1 = new PdfPCell(new…