Localization Flashcards

1
Q

What is a locale?

A

a place representing a country, language or culture

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the diferences of getLanguage(), getCountry() and getVariant() compared to getDisplayCountry(), getDisplayName(), getDisplayLanguage()?

A

getLanguage(), getCountry() and getVariant() returns codes

getDisplayCountry(), getDisplayName(), getDisplayLanguage() return names

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are some ways of creating a locale object?

A
  1. Locale locale1 = new Locale(“it”, “”, “”)
  2. Locale locale2 = Locale.forLanguageTag(“it”);
  3. Locale locale3 = new Locale.Builder().setLanguageTag(“it”).build();
  4. Locale locale4 = Locale.ITALIAN;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the difference between ListResourceBundle and PropertyResourceBundle?

A

you create resources bundles by extending the ListResourceBundle class, whereas with PropertyResourceBundle, you create the resource bundle as a property file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How is the naming convention for the resource bundle?

A

packagequalifier.bundlename + “” + language + “” + country + “” + (variant + “#” | “#”) +
script + “-“ + extensions

for ex. localization.examples.AppBundle_ en_US_Oracle_exam

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the sequence for searching bundles?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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?

A
  1. zoo_fr_FR.java (requested locale)
  2. zoo_fr_FR.properties (requested locale)
  3. zoo_fr.properties (requested locale w/o country)
  4. zoo_fr.properties (requested locale w/country)
  5. zoo_en_US.java (default locale)
  6. zoo_en_US.properties (default locale)
  7. zoo_en.java (default locale w/ country)
  8. zoo_en.properties (default locale w/ country)
  9. zoo.java (no locale at all)
  10. zoo.properties (no locale at all)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or false?

All does have to be in the same resource bundle to be used

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the subclass that the abstract class ResourceBundle has?

A

PropertyResourceBundle and ListResourceBundle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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”)

A

c, d and f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly