Java Localization Improve Computer Literacy Sri Lanka Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Abstract- Computer users all over the world have come to expect their software to "talk" to them in their own language. In order to fulfill this requirement for different users across the globe, internationalization & localization render a great service. In short, Localization (L10N) is the process of adapting a product (a software in this case), to a specific locale such as to its language, standards and cultural norms as well as to the needs and expectations of a specific target market. But in the context of Java there is very little support for Sinhala or Tamil while there is wide support for most European languages which is a boost for software engineers in those countries to write software in native languages or in a manner that supports both English and their mother tongue. Therefore our approach was to introduce a localized application framework extension in Sinhala, which can be integrated with the java platform to create GUI applications, so that developers can utilize the framework in order to develop customized/localized applications to serve the local community in Sinhala.


World is getting smaller. Large organizations are expanding their reach across continents and cultures. Even small, family-owned companies are finding new customer bases and supply chain partners in parts of the world that they would not have previously considered. The Internet which provides the communication backbone for the increasing global interconnectedness and with the English language acting as the common communication medium have brought together wonders in the modern world. However, under no illusion can one forget or underestimate the importance of localization and native languages. This is true especially in countries such as France, Japan, China where almost all communication is done in native languages.

In Sri Lanka, even though English is an official language of the state and commonly used in day today activities in urban areas, when it comes to rural areas, the usage of English decreases dramatically. Because of Sri Lanka is an agriculture oriented country and a large percentage of population living in rural areas, only a very limited percentage of the populace are English literate. If the state of English literacy in Sri Lanka even with the advantage of long term sustained free education is any indication, this is a common issue not only in Sri Lanka but throughout all developing countries.

The lack of English literacy is a major hurdle when it comes to spreading information technology in Sri Lanka because, unlike in contexts such as Europe where users are given ample facilities to interact with computers in their local languages, there's still very little usage of the native languages in Sri Lanka - Sinhala and Tamil, in this regard. This unequal distribution of IT literacy is shown very clearly when we study stats in Fig. 1, which depicts the distribution of computer literacy by provinces in Sri Lanka, which in turn is roughly proportional to the distribution of English literacy in the country

Fig. 1 Computer literacy of household population by province in Sri Lanka [3]

To overcome the issue of lack of English literacy in Sri Lanka, we can take two obvious routes.

1) Increase the level of English literacy all over the country

2) Provide more access to computers through local languages such as Sinhala and Tamil

The first solution is a long-term one, which must be done, with a massive effort from the government to improve learning opportunities in rural areas of the country. Unfortunately, if we wait till English literacy approaches an acceptable level in Sri Lanka, it's likely that most people will lose the chance of learning computer skills and the world will be moving in to the next stage leaving us far behind, making the process of catching up with the world even more difficult. Therefore, we definitely have to consider the second option which is to enable more access to computers in native languages in addition to the first option.

But unfortunately the usage of local languages to interact with computers in Sri Lanka and in fact through out most of the South Asia is very low at the moment. This issue is clearly highlighted in the following citation from the study "Challenges of enabling IT in the Sinhala Language" [1].

"The Sinhala language is spoken by about 15 million people and is the national language of Sri Lanka which has a high literacy rate of over 90%. Computers are in reasonably wide use in the country, especially in offices".

"However, even today, there are no significant databases, very few websites or other on-line documents, and almost no use of e-mail and messaging in Sinhala. This is in stark contrast to European languages, such as Swedish, with far fewer speakers."

However unlike improving English literacy levels in the country, improving access to computers through native languages is something that IT students and people working in the IT industry can help with. To make a contribution to this goal, we decided that it would be extremely useful if we can provide support for Sinhala in Java, as Java is one of the most popular computer languages in the world today.


Improving support for a particular language is not something that can be done by a single person or overnight. When it comes to improving support for Sinhala, there has been a considerable amount of work done by various parties that has made it possible to use Sinhala in various operating systems.

Because of the number of operating systems in use this particular area is a large one in which quite a number of projects are ongoing. As one of the most used operating systems Windowâ„¢ from Microsoft has received particular attention and therefore has been provided with the support that enables the typing of Sinhala and Tamil in any Unicode enabled application. This product is called the Sinhala and Tamil Kit and is available for download online [5] while being a property of the ICTA (Information and Communication Technology Agency of Sri Lanka). This software needs the service pack 2 of Windows XP to be installed in order to work properly. The Microsoft Vista operating system also has a fix provided by Microsoft Corporation enabling similar functionality in Vista OS.

Other operating systems such as Ubuntu or any other Debian based GNU/LINUX have Sinhala support and by doing some slight modifications such as the using of a Sinhala Unicode font, can support the reading and writing of Sinhala. Red Hat Enterprise Linux from version 5 comes with Sinhala support and even allows the installation in Sinhala.

When it comes to web and browser support to Sinhala, both IE 7 and 8 on the windows Vista operating system displays Sinhala without any other additional software. Also Internet Explorer 6 and 7 on Windows XP operating system will display Sinhala correctly once the Sinhala / Tamil kit is installed in Windows XP.

One of the favorite Open Source browsers in the world - Mozilla Firefox has a Sinhala version that not only presents Sinhala correctly but also has its menus and actions in Sinhala [4].


Selecting a proper technology is essential for any IT project to succeed with minimal effort and best performance. The consistent and exclusive use of Unicode together with the built-in libraries for resource files and locales make it easy to create internationalized applications in Java.

Java supports for Sinhala Unicode which lays in the range between hexadecimal values 0D80 to 0DFF, which occasionally used to check if there's Sinhala Unicode fonts installed in a particular system. The corresponding characters for the relevant Unicode values are shown in the following Fig. 2.

When it comes to Java classes and frameworks, there are several major topics that need to be looked at.

Fig. 2 Sinhala Unicode character chart

Java Locale Class

An internationalized program can display information differently throughout the world. For example, the program will display different messages in French, Japanese or English (UK/US) depending on your configurations. If the localization process has been fine-tuned, the program will display different messages in New York and London to account for the differences between American and British English and this is done by referencing a Locale object.

A Locale object is an identifier for a particular combination of language and region. According to the definition by Java locale tutorial, if a class varies its behavior according to Locale, it is said to be locale-sensitive. The real work, such as formatting and detecting word boundaries, is performed by the methods of the locale-sensitive classes.

Java Locale-Sensitive Services SPI (Services provider Interface)

This feature enables the plug-in of locale-dependent data and services. In this way, third parties are able to provide implementations of most locale-sensitive classes in the java.text.spi and java.util.spi packages.

The implementation of SPIs is based on abstract classes and Java interfaces that are implemented by the service provider. At runtime the Java class loading mechanism is used to dynamically locate and load classes that implement the SPI.

Java ResourceBundler Classes

Locale-specific data must be tailored according to the conventions of the end user's language and region. When you need a locale-specific object you fetch it from a ResourceBundle, which returns the object that matches the end user's Locale.


If your application contains String objects that need to be translated into various languages, you can store these String objects in a PropertyResourceBundle, which is backed up by a set of properties files. Since the properties files are simple text files, they can be created and maintained by your translators.


The ListResourceBundle class, which is a subclass of ResourceBundle, manages locale-specific objects with a list. A ListResourceBundle is backed by a class file, which means that you must code and compile a new source file each time support for an additional Locale is needed. However, ListResourceBundle objects are useful because unlike properties files, they can store any type of locale-specific object.

Java Input Method Framework

The input method framework enables the collaboration between text editing components and input methods in entering text. Input methods are software components that let the user enter text in ways other than simple typing on a keyboard. They are commonly used to enter Eastern languages such as Japanese, Chinese, or Korean that consist of thousands of different characters with far fewer keys. However, the framework can be used to input methods for other languages and the use of entirely different input mechanisms, such as handwriting or speech recognition.


To provide Sinhala locale sensitive support for newly introduced Java locale sensitive services SPI, we should be sub-classing abstract classes from java.util.spi or java.text.spi packages to provide our own implementation of these classes and supply language specific information. When this is built as an extension Java runtime will recognize it as a service and load the extension dynamically.

With the intention of allowing scalability in the future to allow more languages used in Sri Lanka such as Tamil, we have defined a generic class set located in net.locale package that directly sub-class from Java SPI service classes and another set of classes that provide Sinhala language information to the Java runtime that resides within the package net.locale.sinhala in our extension as shown in Fig. 3.

Fig. 3 Sinhala locale service providing classes

When it comes to Sinhala Input Method (IM) for Java, A detailed in-depth study was carried out in order to clarify the boundaries of existing Java Input Method Framework. Supported Input styles on the resulting IMF extension and the integration of previously developed simulation algorithm (i.e. Sinhala Phonetic translator) were taken in to account and detailed requirements/designs were further clarified.


With Java 1.6 release it has introduced an SPI called Locale-Sensitive Services SPI [2] which is a feature that enables the plug-in of locale-dependent data and services. Thus, third parties are able to provide implementations of most locale-sensitive classes in the java.text and java.util packages.

This SPI is based on several abstract classes that correspond to Java standard classes that change according to different locales (i.e. Currency, TimeZone) and Java interfaces that are implemented by the service provider. At runtime the Java class loading mechanism is used to dynamically locate and load classes that implement the SPI.

But instead of directly creating a set of classes to subclass java.util.spi.LocaleServiceProvider which is the super class of this SPI, we have created a set of interim generic classes (which reside in net.locale subpackage in our extension) which subclasses SPI classes in java.util.spi and java.text.spi packages. Then in net.locale.sinhala package we have been given all Sinhala language related services by sub-classing net.locale generic classes and these classes are named in the format To provide information on Sinhala locale we have created one repository class containing all locale info about Sinhala called (Ref. Subheading B) which is a subclass of net.locale.LocaleInfo. In this class structure, one can very easily extend this extension to other languages used in Sri Lanka. For example if one wants to extend this extension to support Sri Lankan Tamil locale, he/she can very easily create a package called net.locale.tamil and create all locale specific service classes by sub-classing these generic classes in net.locale package.

The declaration/implementations of key classes/interfaces in this extension are as follows.

public interface LocaleInfo extends Serializable{

void checkLocaleSupported(Locale locale);

String[][] getCountryTuples();

String getCurrencyFormat();

String getCurrencySymbol();

}Net.locale. LocaleInfo Interface

This interface should be adopted by the root class that provides Language specific details (for example in this case).

Net.locale.sinhala. Class

class Sinhala implements LocaleInfo{

private static final Locale si_LK_LOCALE = new Locale("si","LK");

private static final Locale[] SUPPORTED_LOCALES = { si_LK_LOCALE };

private static final String[] ERAS = { "ක්රි.පà·-." , "ක්රි.à·€." }; ......


This is the one key class of this extension that provides all Sinhala language specific details to Locale-Sensitive Services. This class is an implementation net.locale.LocaleInfo and implements all methods specified by the interface. Class

public abstract class LocaleLocaleNameProvider extends LocaleNameProvider {

public abstract LocaleInfo getLocaleData();


public Locale[] getAvailableLocales() {

return getLocaleData() .getSupportedLocales();

} .....


This is one of the generic classes that subclasses Java locale sensitive classes in java.util.spi and java.text.spi packages. This particular generic class works as the intermediate to providing Java runtime what are the locales supported by this extension.

Net.locale.sinhala. Class

public class LocaleNameProvider_si_LK extends LocaleLocaleNameProvider {

static final private LocaleInfo localeData = new Sinhala();


public LocaleInfo getLocaleData() {

return localeData;



This particular class is a set of low level classes that provide Sinhala locale services to the Java Locale sensitive SPI. This particular class informs Java SPI that our extension supports si_LK locale.


According to the Java extension mechanism [6] and Services SPI, we are required to supply a descriptor for each class that works as a localized service. This descriptor supports Java runtime to identify services provided by certain extensions dynamically and should be structured as shown in Fig. 4.

Fig. 4 Descriptor structure for the extension

F Implementation of Java Input Method Framework Extension for Sinhala Support

By using this extension, Swing text components can handle the input method composition on-the-spot, or inline. In other words, the text being composed is immediately visually and logically inserted into the text backing store. Swing text components accomplish this on-the-spot editing style using the client API in the Input Method Framework.

To implement this we have used a string replacing a technique that has been researched by other institutes and tribute must be paid to researchers who have spent time to come up with successful phonetic English to Sinhala techniques that have been used here.


Declare Variables

Vowels and modifiers

vowelsUni[0]="ඌ"; vowels[0]="oo";


vowelsUni[1]="ඕ"; vowels[1]="o\\)";


vowelsUni[2]="ඕ"; vowels[2]="oe";


vowelsUni[3]="ආ"; vowels[3]="aa";


vowelsUni[4]="ආ"; vowels[4]="a\\)";


Special consonants

specialConsonantsUni[0]="ං"; specialConsonants[0]="\\n";


consonantsUni[0]="ඬ"; consonants[0]="nnd";

consonantsUni[1]="ඳ"; consonants[1]="nndh";

consonantsUni[2]="ඟ"; consonants[2]="nng";

Replace Special consonants if there any, in the text area, with corresponding Sinhala Special consonant Unicode characters.

E.g.: Replace With

specialConsonants[0]="\\n"; specialConsonantsUni[0]="ං";


3. Replace Consonants + SpeciaChar combinatioins with curresponding Sinhala ConsonantsUni + SpecialCharUnicode characters.

4. Replace Consonants + r + Vowels with ConsonantsUni + "්‍ර" + vowelModifiersUni

5. Replace Consonants + Vowels with ConsonantsUni + vowelModifiersUni

6. Replace Consonants + HAL with consonantsUni + "à·Š"

7. Replace Vowels with vowelsUni



To evaluate the newly created Sinhala Locale, an application was done to test each functionality offered by the Locale as shown in the Fig. 5 below.

The testing application has 7 tabs named Locale Info, TimeZone, Date & Time, Date Symbols, Currency, Numbers and Decimals in order to separate different functions provided by the locale and test each one of them.

For example, there is a tab to shows how the components of date are being presented in Sinhala locale in a java interface. The "Data Symbols" tab shows the list of days displayed in Sinhala as shown in Fig. 5.

Fig. 5 Date Symbols locale settings

Apart from that, unit test cases have been written covering the whole Sinhala locale which guarantees the quality of the extension.


As the project was of research type we didn't have a particular solution at the beginning. All we needed to know was how far java can be used to implement localized applications and how it can be further enhanced. At the end of the project we have ended up with several outcomes.

A Sinhala Sinhala locale for Java

Sinhala IME

Regarding the future of new Sinhala locale extension and Sinhala phonetic Input Method Editor (IME), they will need user inputs from the Sinhala IT community to improve and enhance their functionalities. Also to keep in par with the continuously evolving Java language, the project will need the contribution of more contributors and thus came the necessity to create a GitHub project named Java_sinhalization in the URL -

By developing this kind of a Java SPI extension to provide Sinhala & Tamil we expect to provide a catalyst to Sri Lankans who are interested in learning java in his/her own language. This would be an advantage to developers as it would make it easy to develop Java applications in Sinhala. Further, it would be a doorway for Sri Lankans to enter to Information Technology world with their own identity.


Authors of this paper would like to thank all researchers, institutes, and geeks who have spent their time and effort into paving underlying support for Sinhala in computers so others won't have to reinvent the wheel. Last but not least they are grateful to the staff at LK domain registry office for providing valuable support and necessary materials.