Showing posts with label Globalization. Show all posts
Showing posts with label Globalization. Show all posts

July 10, 2014

List of Cultures in Asp.Net

Ever wondered the list of cultures and languages available in Here's how you can get the whole list.

July 5, 2009

In this example, I will use the CultureInfo class System.Globalization to instantiate CultureInfo culture and then display the culture name and the currency of that culture. I will first create a Page and in the Page_Load method,

protected void Page_Load(object sender, EventArgs e)
            String[] cultureList = { "en-US", "en-ZA", "en-NZ", "en-CA", "en-AU", "en-GB", "ja-JP", "en-TT", "zh-HK" };
            string newLine = "<br/>";

            for (int i = 0; i < cultureList.Length; i++)
                Response.Write(GetCurrencyForCulture(10, cultureList[i]) + newLine);

I am creating string array called cultureList containing a list of culture names. Then, I am creating a string variable containing the break tag.

Then, creating a for-loop that runs for each item in the cultureList array and calls the method GetCurrencyForCulture.

The code for GetCurrencyForCulture() method is below,

private string GetCurrencyForCulture(int i, string cultureName)
            CultureInfo ci = new CultureInfo(cultureName);//creating CultureInfo object
            return ci.EnglishName + " - " + i.ToString("c", ci) ;

In this method, I am creating a new CultureInfo object based on the string parameter "cultureName" passed and then returning the EnglishName and formatting integer variable passed in as the parameter.

Running the page gives the following output,

English (United States) - $10.00
English (South Africa) - R 10.00
English (New Zealand) - $10.00
English (Canada) - $10.00
English (Australia) - $10.00
English (United Kingdom) - £10.00
Japanese (Japan) - ¥10
English (Trinidad and Tobago) - TT$10.00
Chinese (Hong Kong S.A.R.) - HK$10.00
Reference: Shahed Kazi at