How to store information about a user's locale in ASP.NET?

lakhansin-22735
Posted by lakhansin-22735 under ASP.NET category on | Points: 40 | Views : 9174
Here, I have describe about Localization feature of ASP.NET. The main motive of this section is only to familiar what exactly is localization feature of ASP.NET?

Localization is the feature of ASP.NET through which an application may be localized for a specific location. There are built-in mechanisms in .NET to allow localization process. The concept of localization is achieved in .NET as .NET is based on Unicode, thus it allows multiple characters of regions across the globe to be sent across in applications.

In .NET, the concept of localization is achieved using the System.Globalization namespace.
A class named CultureInfo is used to localize .NET objects in the web applications. The functions provided in the globalization namespace work in tandem with the browser's culture encoding properties. In order to set the culture encoding of a web application, changes may simply be done in the web.config file.
<configuration>
<system.web>
<globalization
requestencoding="utf-8"
responseencoding=" utf-8"
fileencoding=" utf-8"
culture="hi-IN"
uiculture="en" />
</system.web>
</configuration>

Here, the default culture is set to Hindi (hi-IN).
However, the rest of the web application will use UTF8 character encoding. The default UI culture is "en" by default. Now in order to render different locality specific characters for different locations, different folders with their own Web.config files are created. Each of this folder will cater to a location. Note that in ASP.NET, a web.config file is allowed on any folder, this web.config file will override any settings provided in the web.config of any of its parent folder.

This is how locale specific directories are created for a site. Further note that culture settings may be set at page level as well. This is done using the @Page directive by setting its culture attribute to the desired culture.
<%@ Page Culture="hi-IN" UICulture="hi" ResponseEncoding="utf-8"%>

Instances of the CultureInfo class may also be created in code, to set the culture of a page through code.

That's all from my side but can find some many stuff on localization in web world.

Keep learning and practicing.

Comments or Responses

Login to post response