Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get language name from locale string using .NET? ex: en_us => english

How can i find the language for a given locale?

Example: input: en_US output: English

Using the .NET libraries? I tried the CultureInfo class, but i can't find something usefull.

Thanks!

like image 603
ThdK Avatar asked Apr 20 '11 12:04

ThdK


People also ask

What is Java locale string?

A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user.

What is locale settings?

The locale setting defines the language of your user interface and the display formats for information like time, date, and currency.

What is locale default?

When the Java virtual machine starts running on a computer, it creates an object called the default locale. This object affects the format of strings created from data. Depending on the default locale, a program creates different strings for the same number.


1 Answers

You need to use en-US not en_US with code like:

System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-US");
string name = culture.DisplayName;

output: English (United States)

like image 80
Chris Snowden Avatar answered Oct 05 '22 22:10

Chris Snowden