Tuesday, July 21, 2009

Internationalizing Web Applications

There are two important ways of internationalizing Web Applications - Using Resource Bundles and Using locale specific JSP pages.

Using resource bundles

Internationalization can be achieved by using resource bundles in Web Applications like Java Server Pages with the Java Server Faces framework. In such applications, the resource bundles created are similar to those created in the desktop applications. To use these resource bundles, they are registered with the web application in the form of a JSF config file with the required XML content.

Using locale specific JSP pages

Another way to achieve internationalization is to use different sets of JSP pages for different languages. This method mainly maintains a mirror copy for each of the language and, the locale specific JSP set is sent to the client on demand. However this method would result in more number of JSP pages but would provide greater customizability.

Internationalizing Java Desktop And Console Applications

Internationalizing a Java application mainly uses the concept of resource bundles. The User-Interface code interacts with the resource bundles to extract the required information, thereby forming the User-Interface on the screen in the desired language.

The various message labels, messages in dialog boxes, button text, etc. are to be translated to make these components for a non-English speaker. So these strings are separated from the program into a central external repository. These repositories are called as resource bundles in Java. They contain the appropriate content for the text messages in various languages for the targeted locales.

These resource bundles many contain icons, pictures, actual UI elements like menus and buttons and even new window layouts, besides messages and other user-visible strings.

The resource bundles are a collection of properties files. A properties file exists for each locale targeted by the application. A properties file consists of key-value pairs. As the language changes, the key does not change, but the value changes. The components in the User-Interface code are referenced by the keys of the properties file. So as the language changes, the UI code need not be modified, the application will find the required properties file and use the corresponding value for each instance of the key in the program. The properties files of the resource bundle follow a naming convention which is of the form - bundle-name_language_country-code.

E.g. consider a file which uses a key called greeting to welcome a user
For English the properties file would contain greeting = hello
For French the properties file would contain greeting = bonjure

So whenever the programmer wishes to welcome the user, the greeting key might may be used. If the locale is set to English (United States), "hello" is displayed. Else if the locale is set to French (France), "bonjure" is displayed.

Internationalization Support In Java

The entire Java platform is internationalized. Java provides an extensive library of classes and functions to help in internationalizing programs. Built-in I18n for Java comes with support for over 70 languages. I18n support comes for free or at very little cost.

All text in a running Java program is Unicode. Unicode was a brave effort to create a single character set that included every reasonable writing system. As a result the Unicode character set has support for almost every language script used in today’s world. Using this Unicode character set, Java provides a platform for Internationalization.

In Java the primitive type char is a single Unicode character. Similarly a String is a collection of these Unicode characters. All internal processing on text assumes the text to be in Unicode format.

Globalized Solutions - Basic Application Structure

Any application can be divided into three primary components - Front End, Business Logic and Persistence.

Internationalization primarily applies to the front end GUI and back-end data persistence. Business Logic need not be modified during the localization of the application. In frameworks like MVC, Struts, Spring, the business logic is completely separated from the GUI and in such frameworks, internationalization is easily implementable.

Internationalizing Programs

An internationalized program has the following characteristics -

  • With the addition of localized data, the same executable can run worldwide
  • Textual elements, such as status messages and the GUI component labels are not hardcoded in the program. Instead they are stored outside the source code and retrieved dynamically
  • Support for new languages does not require recompilation
  • Culturally dependent data, such as dates and currencies, appear in formats that conform to the end user’s region and language
  • It can be localized quickly

Globalization Terms

The most commonly used buzz-words in the Globalization market are Globalization, Translation and Localization and Internationalization. This article demystifies these terms.

Globalization [G11n]

Globalization addresses the business issues associated with making a product global. In the globalization of high-tech products, this involves integrating localization throughout a company, after proper internationalization and product design. This also involves marketing, sales, and support in the world market.

Globalization is mainly realized at the architecture level. There are two ways of achieving globalization - Internationalization and Localization.

Translation [T9n]

Translation is the process of converting text in one language to text in another language.

Localization [L10n]

Localization involves taking a product and making it linguistically and culturally appropriate to the target locale (country, region and language) where it will be used and sold.

Localization involves two operations - Translation and Engineering. This process primarily focuses on translating the various locale-specific data, like pictures, colors, text, etc. and then making required changes in the application code to meet the requirements of the locale.

Internationalization [I18n]

Internationalization, on the other hand, is the process of generalizing a product so that it can handle multiple language and cultural conventions without the need for re-design. It guides the developers to write program code with anticipation of locale change.

Internationalization takes place at the level of program design and document development. This is achieved by the concept of resource bundles. This approach is primarily driven by MVC architectures. The focus is on separating the GUI so that the multi-language support is easily implemented while keeping the Business Logic and Persistence as standard for a variety of users. Today Internationalization capability for any solution that is being developed is a mandated requirement.

Acronym Rules

Following the standard rules for abbreviating these words, the following acronyms will be used for the above terms in the rest of the series.

Globalization - G11n
Translation - T9n
Localization - L10n
Internationalization - I18n

These acronyms are built using a simple philosophy. The acronym consists of the first letter and the last letter with the number of characters between them as a numeral.

E.g. Consider Internationalization. It starts with I, ends with n and has 18 characters between I and n. So it is abbreviated as I18n.

Application Developers And Globalized Applications

Considering the factors mentioned in the previous blog posts, it is evident that organizations will focus on people with globalized application development or management skills. Hence it is very important that the developer community is enabled with this skill.

Requirements in future could be to globalize an existing product or develop new product for a global market. The subsequent posts provide the various facets of globalized applications leveraging the skills that are already known to the developer community.

The Case For Globalized Solutions

Globalized Solutions are becoming more important today due to some of the key trends like GDP by Region, World Population Distribution and Increased Investment in Emerging Markets. This post will emphasize the effect of these trends on Globalization.

GDP by Region

Here is a graph of the world GDP distribution. As evident from the graph, though North America is the largest part, it is still only a third of the entire GDP. The other markets like European Union, Japan, China together form a large chunk of the GDP graph. People in these countries obviously don’t speak English natively. Even small percentage penetration into these markets can improve margins significantly for companies.

World Population Distribution

Here is a graph of the world population distribution. Notice how radically the ranking change from the GDP graph.

Observe that more than half of the world’s population is in Asia, where a large chunk of non-English speaking population exists. China is fully dominated by Chinese language. India is dominated by multiplicity of languages each having a potential business opportunity.

Increased Investment in Emerging Markets

Many companies are creating business units around emerging markets like China and India as they see their future business coming from these markets. There is a significant push in these countries to modernize right now and this is moving at a significant pace.

Several real-life examples can be seen like - Usage of Mobile devices, Usage of Bank ATMs etc. As one can see today ATMs in India offer solution using Local Language / English. Mobile companies are offering solutions that allow messages to be sent in different local languages.

Emerging Markets - As good as Developed Countries

Business conglomerates, similar to developed countries are evolving in emerging markets. Companies like Bharti Airtel, Vodafone, BSNL are comparable to Verizon, AT&T etc, Banks like ICICI, SBI are no smaller than Bank of America, Citibank etc. Retail channels like Reliance Fresh, Future Bazaar, etc are similar to Wal-Mart, Radio Shack etc. Similar situations exist in China. In addition many of the multinational organizations are setting up operations in emerging markets. However customer reach can increase in these markets if offerings are expanded in different local languages.

Globalized Solutions - Introduction

In order to manage the impact of economic recession and stay profitable, many software organizations today are looking at expanding their offerings beyond the traditional US markets. Emphasis on reaching customers across the globe especially those who are located in emerging markets like European Union, China, India etc. is gaining momentum. One of the main criteria in reaching to these markets is to understand their culture and deliver products in their native language. Organizations are evaluating at models and methodologies to enhance their existing and futuristic solution portfolios to cater the global audience.

Globalized Solutions - Breaking The Barriers Of Language

Many Software Organizations today are looking at expanding their product sales, solutions and services towards emerging markets. Instead of relying on only the traditional US markets essentially dominated by the English language, companies have increased their focus on expanding business in language sensitive countries like European Union, China, India etc., One of the main criteria in reaching to these markets is to understand their culture and deliver products in their native language.

In such a scenario and also in falling job markets, specialized skills become important and knowledge of Internationalization of Applications would be one such key skill. This series of blog posts provides approaches for quick learning and building this capability.

Various techniques like Translation and Internationalization are applied with respect to communication, document reading and Application Development.

Internationalization provides a mechanism of simplifying the requirement of locale-specific applications, without losing the existing big English speaking markets like US, UK, etc. Developers can leverage programming languages like Java which internally support Internationalization for various desktop, web and mobile applications.

View the entire paper here and the presentation here. Download the sample applications here.