Created
October 18, 2019 17:40
-
-
Save vgerbase/caffbc9e4cd42662e45ec0ea892008e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Globalization; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
decimal value = 123456.7890m; | |
// Get all available cultures on the current system. | |
var cultures = | |
CultureInfo.GetCultures(CultureTypes.SpecificCultures) | |
.Where(c => !c.TextInfo.IsRightToLeft) | |
.OrderBy(c => c.Name); | |
Console.WriteLine( | |
"{0,-42} {1,-6} {2,-14} {3,-10} {4,-10} {5,-10} {6,16}\n", | |
"Display Name", "LCID", "Name", "2LetterISO", "3LetterISO", "Symbol", "$"); | |
foreach (var culture in cultures) { | |
// Exclude custom cultures. | |
if ((culture.CultureTypes & CultureTypes.UserCustomCulture) == CultureTypes.UserCustomCulture) | |
continue; | |
// Exclude all non two-letter codes. | |
if (culture.TwoLetterISOLanguageName.Length != 2) | |
continue; | |
Console.WriteLine( | |
"{0,-42} {1,-6} {2,-14} {3,-10} {4,-10} {5,-10} {6,16}", | |
culture.DisplayName, | |
culture.LCID, | |
culture.Name, | |
culture.TwoLetterISOLanguageName, | |
culture.ThreeLetterISOLanguageName, | |
culture.NumberFormat.CurrencySymbol, | |
value.ToString("C", culture)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment