Monday, October 22, 2018

Localization and Globalization in ASP.Net

Most websites on the internet are designed and developed to support a single language and culture, but making a website or web application to support different languages and cultures is not difficult and easy to implement in ASP.Net.

Globalization is the process of designing and developing applications that function for multiple cultures. Localization is the process of customizing your application for a given culture and locale. 

ASP.Net localizes an application through the use of resource files. Resource files are xml files with .resx extension. Resources can either be a global resource, in which it is accessible throughout the site and placed in App_GlobalResources folder in a website or a local resource which is specific to a page only and is placed in App_LocalResources folder. 
        
        In Visual Studio right click the website in solution explorer and select Add ASP.Net Folder then select App_GlobalResources. After that, right click the App_GlobalResources and select Add New Item in the list of items displayed in the dialog box then select Resource File and give it any name. The next thing is to create our language specific resource files. Each language requires different resource file. A resource file takes a key name & value pair, so all the resource files will contain the same key but the different values as the language translation.

We need to override the page's InitializeCulture() method and set the page UICulture & Culture property, this property determines which global or local resource to be loaded for the page. ASP.Net checks the languageid and cultureid combination on the browser to determine the resource file to be used in rendering contents to that browser. to see the detailed list of languages and cultures identification click here. CLICK HERE

         To watch the demonstration click here: WATCH VIDEO

Prof. Shardul P. Patil
profshardulp.patil@gmail.com

No comments:

Post a Comment