About BhashaIndia | Contribute | SiteMap | Register | Sign in to Windows Live ID
  Developers Patrons
Hindi Tamil Kannada Gujarati Marathi Telugu Bengali Malayalam Punjabi Konkani Oriya Sanskrit Nepali
Home > Developers > MSTech > Application > .NET Multilingual Applications Welcome Guest!

Developing multilingual applications in .Net

By Srimathi - Vishwak Solutions Pvt. Ltd.,

Published on 7th November 2003

Developing multilingual applications in .Net can be done in different ways.

ASP.Net gives support for Unicode based languages natively.

The two different ways of developing a multilingual site are as follows:

  1. Simple Way: Maintaining pages for each language separately, preferably in different folders for each language.
  2. Classic Way: Having resource files for each language and displaying content in webpage from the required resource file, based on user’s preference.

Simple Way: Multiple code bases for different languages

Taking the first approach of maintaining same copy of pages for each language, the content of the page can be save in ASPX pages, but while saving the file “Save With Encoding” option should be selected and UTF-8 encoding should be selected for any of the Indian languages. This means the duplicate copy of the whole site has to be maintained for each language. The directory structure can be maintained for each language, where language code itself will be a folder.

Taking the above given scenario the folder structure as given in the following picture

Disadvantages

The disadvantages of using this approach are given below:

  1. Keeping the content sync with all the languages becomes difficult.
  2. Whenever there is a change in the content multiple pages need to be changed.
  3. For any simple change in the content, whole application has to be recompiled.
  4. When the contents changes the content updaters should directly access the page, till then the developers will not be able to do any changes
  5. If the web application needs to provide support for new language the whole set of pages has to be recreated.
  6. Thus maintenance of the web application becomes complex.

The alternative would be to have the content for each language in the database and display it to the user. This makes maintenance easy, but fetching content from the database and displaying will slow down the application. Also this approach requires database storage and lots of coding related to that.

Classic Way: Single code base and Multiple Content

The better way is to have the content in resource file. Resource file is non-executable file that is logically deployed with the application. The content can be displayed in any of the user interface elements (server controls like, label, textboxes, checkbox, combo box etc.,) or directly displayed as HTML content or as alerts. It can contain strings, images, icons, cursors or persisted objects.

Read more on Common terms used in .Net, related to resource files

Using Resource Files – Advantages

Globalization can be achieved in the application by the usage of resource files, i.e., usage of resource files allows changing the content of pages without recompiling the whole application.

The advantages of using the resource files are given below:

  1. Removes all content from the presentation layer and code base. Single code base and presentation layer which will present different content for any culture
  2. Content will be separated from the application, but available in location accessible by the application
  3. Whenever there is change in the content file the code base and presentation layer will not get affected.
  4. The content as well as the user input format will be stored that can be presented based on current culture.

Read more on Creating and Using the Resource files.

Fonts in Client Browser

While taking any of the above approaches, the first question that arises is how it will get rendered in client’s browser? This question can be answered by the use of EOT font files. (EOT – Embedded Open Type). The following steps have to be followed to use this EOT file in a web application.

Note: If the application doesn’t have any CSS file, then the EOT file should be referred in all the ASPX pages of the web application.

  1. Get the .eot file for the font of the language preferred
  2. Upload the file in a URL
  3. Refer the URL in CSS file used in the application
  4. Use the CSS file in all the web pages of the application

Note: If the application doesn’t have any CSS file, then the EOT file should be referred in all the ASPX pages of the web application.

The font in EOT file can be referred in CSS file as follows:

@font-face
{
font-family: <YourlanguageFontName>;
font-style:normal;
font-weight: normal;
src: url(http://<yoururl>/fonts/filename.eot);
}

Reference URL’s

MSDN Article - http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/aspnet-globalarchi.asp
http://www.dotnetbips.com/displayarticle.aspx?id=214

Partner Profile | Privacy Statement | Why Passport | Testimonials
This site uses Unicode for non-English characters and uses Open Type fonts.
©2003-2007 Microsoft Corporation. All rights reserved.