Internationalization, Localization and more
There is a lot of loose use of these words and you can throw in the words "globalization" and "translation" too. I am ok with this loose usage but, will try to define each word in a strict and loose sense below. First, lets look at Google's interface after I have altered my browser to have "es-MX" meaning Spanish, Mexico as the language.
Internationalization
- loose definition: the process of taking a system (program, web site, etc) and converting it so it works in a different language (and possibly different character set)
- User Interface (strings, labels, text)
- Time, Money, Special symbols (as part of the UI there can be the language specific way of showing time, money and special symbols).
- Algorithms like search, sort based on specifics of language or character set involved
- i18n - this is a numeronym standing for internationalization...where there are 18 letters between the starting i and ending n.
Localization
- loose definition: extending Internationalization so it can even involve locale specific versions of a language--like Mexican Spanish versus Spanish (Spain) or US English versus Autstralian English
- strict definition: after the formal (strict) step of internationalization (software seperating out on anything that may need to be represented in another language/character set) you perform translation of items and then associate with specific locales.
- L10n - again a numeronym and stands for Localization wher 10 is the number of characters between starting L and ending n in the work "Localization".
Services and Tools
There are possibly many. Some people will do "manually" and hire translators. Some tools are specific to the platform and/or programming language code you are developing in.
Search for your Own!!!
Here are some links (let me know if they go away---but, this is a changing field you will need to find your own current references). In NO order
- Internationalization for NodeJS
- https://webtranslateit.com/
- IBM Globalization
- Microsoft Globalization tips
- YUI and internationalization
- Narrow scope --only run in googles platform as "widget" --Google Gadgets
- Get-text (store all items for translation in getext files). Opensource. Supports multiple languages (php, etc).
Java and Internationalization
Java supported Internationalization. It uses UTF standards for encoding. Has classes like Locale and Locale.Builder
Locale aLocale = new Builder().setLanguage("sr").setScript("Latn").setRegion("RS").build();
//how to use Locale
Locale loc = new Locale("da", "DK"); NumberFormat nf = NumberFormatProvider.getNumberInstance(loc);
other methods
- getCurrencyInstance(Locale locale)
- getIntegerInstance(Locale locale)
- getNumberInstance(Locale locale)
- getPercentInstance(Locale locale
Java and Resource Bundles
Lesson: Isolating Locale-Specific Data
Locale-specific data must be tailored according to the conventions of the end user's language and region. The text displayed by a user interface is the most obvious example of locale-specific data. For example, an application with a Cancel button in the U.S. will have an Abbrechen button in Germany. In other countries this button will have other labels. Obviously you don't want to hardcode this button label. Wouldn't it be nice if you could automatically get the correct label for a given Locale? Fortunately you can, provided that you isolate the locale-specific objects in a ResourceBundle.
In this lesson you'll learn how to create and access ResourceBundle objects. If you're in a hurry to examine some coding examples, go ahead and check out the last two sections in this lesson. Then you can come back to the first two sections to get some conceptual information about ResourceBundle objects.
1) About the ResourceBundle Class
ResourceBundle objects contain locale-specific objects. When you need a locale-specific object, you fetch it from a ResourceBundle, which returns the object that matches the end user's Locale. This section explains how a ResourceBundle is related to a Locale, and describes the ResourceBundle subclasses.
To select the appropriate ResourceBundle, invoke the ResourceBundle.getBundle method. The following example selects the ButtonLabel ResourceBundle for the Locale that matches the French language, the country of Canada, and the UNIX platform.
Locale currentLocale = new Locale("fr", "CA", "UNIX");
ResourceBundle introLabels = ResourceBundle.getBundle("ButtonLabel", currentLocale);
If a ResourceBundle class for the specified Locale does not exist, getBundle tries to find the closest match. For example, if ButtonLabel_fr_CA_UNIX is the desired class and the default Locale is en_US, getBundle will look for classes in the following order:
ButtonLabel_fr_CA_UNIX
ButtonLabel_fr_CA
ButtonLabel_fr
ButtonLabel_en_US
ButtonLabel_en
ButtonLabel
2) Preparing to Use a ResourceBundle
Before you create your ResourceBundle objects, you should do a little planning. First, identify the locale-specific objects in your program. Then organize them into categories and store them in different ResourceBundle objects accordingly.
Look for objects that vary with Locale. Examples
- String
- Image
- Color
- AudioClip
NOTE: This list doesn't contain objects representing numbers, dates, times, or currencies. The display format of these objects varies with Locale, but the objects themselves do not. For example, you format a Date according to Locale, but you use the same Date object regardless of Locale. Instead of isolating these objects in a ResourceBundle, you format them with special locale-sensitive formatting classes. You'll learn how to do this in the Dates and Times section of the Formatting lesson.
Date today;
String result;
SimpleDateFormat formatter;
DateFormatSymbols symbols;
String[] defaultDays;
String[] modifiedDays;
symbols = new DateFormatSymbols(new Locale("en","US"));
defaultDays = symbols.getShortWeekdays();
3) Backing a ResourceBundle with Properties Files
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. You don't have to change the source code. In this section you'll learn how to set up the properties files that back up a PropertyResourceBundle.
Using a ListResourceBundle
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. By stepping through a sample program, this section demonstrates how to use a ListResourceBundle.
Customizing Resource Bundle Loading
This section represents new capabilities to improve the ResourceBundle.getBundle factory flexibility. The ResourceBundle.Control class collaborates with the factory methods for loading resource bundles. This allows to consider every substantial step of the resource bundle-loading process and its cache control as a separate method.