Localization Flashcards
What is a locale?
a place representing a country, language or culture
What are the diferences of getLanguage(), getCountry() and getVariant() compared to getDisplayCountry(), getDisplayName(), getDisplayLanguage()?
getLanguage(), getCountry() and getVariant() returns codes
getDisplayCountry(), getDisplayName(), getDisplayLanguage() return names
What are some ways of creating a locale object?
- Locale locale1 = new Locale(“it”, “”, “”)
- Locale locale2 = Locale.forLanguageTag(“it”);
- Locale locale3 = new Locale.Builder().setLanguageTag(“it”).build();
- Locale locale4 = Locale.ITALIAN;
What is the difference between ListResourceBundle and PropertyResourceBundle?
you create resources bundles by extending the ListResourceBundle class, whereas with PropertyResourceBundle, you create the resource bundle as a property file
How is the naming convention for the resource bundle?
packagequalifier.bundlename + “” + language + “” + country + “” + (variant + “#” | “#”) +
script + “-“ + extensions
for ex. localization.examples.AppBundle_ en_US_Oracle_exam
What is the sequence for searching bundles?
Step 1. The search starts by looking for an exact match for the resource bundle with the full name
Step 2. The last component (the part separed by _ ) is dropped and the search is repeated with the resulting shorter name. This process is repeated till the last locale modifier is left
Step 3. The search is restarted using the full name of the bundle for the default locale
Step 4. Search for the resource bundle with just the name of the bundle
Step 5. If search fails throw MissingBundleException
Given the following:
Locale france = new Locale("fr", "FR") ResourceBundle rb = ResourceBundle.getBundle("zoo", locale)
what are the steps that java will do to try to find the locale?
- zoo_fr_FR.java (requested locale)
- zoo_fr_FR.properties (requested locale)
- zoo_fr.properties (requested locale w/o country)
- zoo_fr.properties (requested locale w/country)
- zoo_en_US.java (default locale)
- zoo_en_US.properties (default locale)
- zoo_en.java (default locale w/ country)
- zoo_en.properties (default locale w/ country)
- zoo.java (no locale at all)
- zoo.properties (no locale at all)
True or false?
All does have to be in the same resource bundle to be used
False
What are the subclass that the abstract class ResourceBundle has?
PropertyResourceBundle and ListResourceBundle
Identify the valid statements:
a) Locale myLocale = System.getDefaultLocale();
b) Locale myLocale = Locale.getDefaultLocale();
c) Locale myLocale = Locale.getDefault();
d) Locale myLocale = Locale.US;
e) Locale myLocale = Locale.getInstance();
f) Locale myLocale = new Locale(“ru”, “RU”)
c, d and f