...

/

Detecting and Configuring Culture and Language

Detecting and Configuring Culture and Language

In this lesson, we will learn how to set up languages and cultures supported by an application, and how to select the more appropriate one for each request.

Modern application frameworks support cultures, instead of just languages. A culture is a wider concept than a language since it also involves the way numbers and dates are formatted.

Number/date+time formats may be different for cultures associated with the same language. For instance, in the United Kingdom dates follows the day/month/year pattern while in the United States they follow the month/day/year pattern. Therefore, cultures are tied, not only to specific languages but also to language-Country pairs.

According to international standards, we should name cultures with 5 character strings of the type “xx-XX”. In this case, “xx” is the two-character code of the language, while “XX” is the two-character code of the country. Language codes are always lower case, while country codes are always uppercase. For instance, the culture associated with the English of the Great Britain is named “en-GB”, while the English culture for the United States is named “en-US”.

Each culture has an “xx” two character parent culture that contains just its language part. Thus, for instance, the parent culture of both “en-US” and “en-GB” is “en”. The number/date+time settings of the “xx” culture are usually taken from a five-character culture that is assumed as a reference for the language. For instance, settings for the “en” culture are taken from the “en-US” culture assumed as a reference for the English language.

Cultures in .NET

...
Access this course and 1400+ top-rated courses and projects.