Internationalization, Localization and moreThere 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
Localization
Globalization
Services and ToolsThere 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
Java and InternationalizationJava 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
Java and Resource Bundles Lesson: Isolating Locale-Specific DataLocale-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 ClassResourceBundle 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 ResourceBundleBefore 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
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 FilesIf 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 ListResourceBundleThe 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 LoadingThis 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.
Java Resources |