1) What are the three elements that make up a Java Locale?
A - Language, Country, and a Variant.
2) What is the ISO standard that defines available "Variants?"
A - While there are ISO standards that are used for the Language and Country code, the Variant is up to the developer.
3) What GUI considerations do you need to make, in regards to localization?
A - Text expansion / contraction / direction. Elements such as table cells can be pushed out in ways not expected or visible when viewing a page in one's native language.
4) What is the difference between "internationalization" and "localization?"
A - Internationalization is the process of extracting hard coded regional specific information (text, date/time stamps, number formatting, etc.) and using various APIs to return localized content at runtime. Localization is the process of creating one or more "resource bundle" with regional specific information. For example, one would internationalize their application to prepare it for serving any number of languages / regions, and would later localize the application for the languages / regions they wish to support (by creating a resource bundle for each region).
5) What is the purpose of a ListResourceBundle?
A - To return any kind of localized object the developer wishes. This is in contrast to creating a property resource bundle which handles localized text.
6) How do you pass parameters to a PropertyResourceBundle?
A - First you put place holders in your property file for where you want the parameters to appear in the text. These place holders are written as zero-indexed integers surrounded by curly braces (i.e. Hello {0}, Today's date is {1}). Next the parameters are substituted with the actual data at runtime by using the MessageFormat class.
7) How do you implement a "locale-agnostic" search or sort algorithm?
A - Use a Java Collator
8) What happens if you have a resource bundle that is more specific than a user's submitted locale (i.e. a user's locale is "en", and your resource bundle is "en_US")?
A - If this is the only resource bundle created for the application, the bundle would not be located. The search pattern for a locale is to find the exact resource bundle submitted, and if nothing is found, it will try to find a more general bundle. Since the language code is the most general locale that can be created, it will attempt to find a resource bundle that matches the application's default locale (or something more general). Finally it will try to find a resource bundle with no locale specified at all.
My next entry will be focused on the topic of Access Modifiers in Java. The basic, and most common usage (private properties and public methods) result in fairly predictable results, but you may be surprised by some of the visibility issues with protected and package modifiers!

0 comments:
Post a Comment