BANGALORE, INDIA: If a website wants to pull a large number visitors then it is important to provide more localized content. This means that the site should show up in the local language of the visitors accessing the webite. For example if a non-English reader wants to access your website and your website is not localized in his/her language, then you might end up losing that visitor.
But if your website is localized, you might be able to retain that visitor. With the help of Web developer 2008 ASP.NET AJAX, you can build such websites in minutes. But the only issue is that you should have a translator who knows and can translate different languages.
|
Direct Hit!
|
Applies To: Web developers
USP: Localizing your website
Primary Link: msdn.microsoft.com
Keywords: Localization in AJAX |
Earlier, developers used to develop such website, ie, localized websites with the help of ASP.NET. So what's different in using Web developer 2008 ASP.NET AJAX? Well the difference lies in the term AJAX. Earlier whole page had to be rendered from the server and then the required language was shown to the user. And if the user asks for any other response from the server then also the whole page had to be refreshed.
The technique behind this is that there is a global resource residing on the server which consists of some keywords that do not change in any case, ie the name doesn't depend on the language setting of the user. And there is local resource on the server which contains all the substitutes for the words that will be changed according the language displayed. Now using the AJAX the resource gets downloaded on the client itself and whenever the user demands for any language change then immediately the language is change after he/she presses refresh button. But this time the text or labels are not rendered from the server but the local resource that is downloaded at the client side is used.
Now let us make a simple ASP.NET web site in which we will be implementing the localization option. For this open the web developer 2008 and create a new project named as 'websitelocalizaiton'. Now go to 'Website' menu and click on 'Add new item', select the template as resource file, provide the resource file name as 'global' and then click on 'Add'. Then it may ask you to place the resource file in the 'App_GlobalResources' folder, ideally it should be done, hence click on 'Yes'.
Once you have added the resource file you will see a screen similar to that of Access data table. Under the name field write 'Heading' and under the value field write 'THIS IS A TEST WEBSITE'. It can be understood as the 'Name' field which is the variable and the 'Value' field is the value associated with the Name. Now save the resource file and close it. Similarly add a new resource file and name it as 'default.aspx.resx' where we will keep English words and add another named default.aspx.fr.resx where we will keep some words of French language(for example).
Add some name and value associated with the 'Name' field, as shown in the image. Add local resource folder to your website, by clicking on 'App_LocalResources' option from website > Add ASP.NET folder and move the default.aspx.resx and default.aspx.fr.resx to 'App_LocalResources' folder.