Culture and UI Culture for ASP.NET Web Page Globalization
In an ASP.NET Web page, you can set to two culture values, the Culture and UICulture properties. The Culture value determines the results of culture-dependent functions, such as the date, number, and currency formatting, and so on. The UICulture value determines which resources are loaded for the page
Note
The Culture and UICulture properties are set using Internet-standard strings that identify the language (for example, en for English, es for Spanish, and de for German) and culture (for example, US for the United States, GB for Great Britain, MX for Mexico, and DE for Germany). Some examples are en-US for English/United States, en-GB for English/Great Britain, and es-MX for Spanish/Mexico. For more information, see CultureInfo
The two culture settings do not have to have the same value. Depending on your application, it might be important to set them separately. An example is a Web auction site. The UICulture property might change for each Web browser, whereas the Culture stays constant. Therefore, prices are always displayed in the same currency and formatting. The Culture value can be set to specific cultures only, such as en-US or en-GB. This prevents the requirement to identify the correct currency symbol to use for en, where en-US and en-GB have different currency symbols.
Users can set the UI culture and culture in their browsers. For example, in Microsoft Internet Explorer, on the Tools menu, users can click Internet Options, on the General tab, click Language, and then set their language preference. If the enableClientBasedCulture attribute of the globalization element in the Web.config file is set to true, ASP.NET can set the UI culture and culture for a Web page automatically, based on the values that are sent by a browser.
It is not a best practice to rely exclusively on browser settings to determine the UI culture for a page. Users frequently use browsers that are not set to their preferences (for example, in an Internet cafe). You should provide a method for users to explicitly choose a language or language and culture (CultureInfo name) for the page
Comments
Post a Comment