Package oracle.i18n.util
Class OraDisplayLocaleInfo
- java.lang.Object
-
- oracle.i18n.util.OraDisplayLocaleInfo
-
public class OraDisplayLocaleInfo extends Object
TheOraDisplayLocaleInfoclass is a utility class that provides predefined translations for locale related attributes. These attributes can be items like the display name for locales, languages, character sets, timezones, etc.To use the services of this class, first an
OraDisplayLocaleInfoobject should be instantiated by calling thegetInstance(java.util.Locale)method. ThegetInstance()method takes aLocaleparameter that controls the translation language of any locale display items that are retrieved via the API. The example below shows how to retrieve a German translation for the Java timezone identifier America/Los_Angeles:... OraDisplayLocaleInfo odli = OraDisplayLocaleInfo.getInstance(Locale.GERMANY); TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles"); // tzName will contain the localized time zone string in German. String tzName = odli.getDisplayTimeZone(tz);- Since:
- 10.1.0.2
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String[][]getAvailableLanguages(Locale translocale)Returns the available language IDs along with their corresponding display names sorted in the translated display name order.static String[][]getAvailableTerritories(Locale translocale)Returns the available territory IDs along with their corresponding display names sorted in the display name order.static ListgetCommonLocales(Locale translocale)Returns a list of the common locales sorted by the translated names.StringgetDisplayCharacterSet(String charset)Returns a translated character set name.StringgetDisplayCountry(String country)Returns a translated country or territory name.StringgetDisplayCountry(Locale locale)Returns a translated country or territory name.StringgetDisplayCurrency(String currencySymbol)Returns a translated currency name.StringgetDisplayLanguage(String language)Returns a translated language name.StringgetDisplayLanguage(Locale locale)Returns a translated language name.StringgetDisplayLinguisticSort(String linguisticSort)Returns a translated linguistic sorting name.StringgetDisplayLocale(String oraLanguage, String oraTerritory)Returns a translated locale name for the passed in language/territory combination.StringgetDisplayLocale(Locale locale)Returns a translated locale name for the passed in locale parameter.StringgetDisplayTerritory(String territory)Returns a translated country or territory name.StringgetDisplayTimeZone(int style, String tzs)Returns a translated time zone name.StringgetDisplayTimeZone(int style, TimeZone tz)Returns a translated time zone name.StringgetDisplayTimeZone(String tzs)Returns a translated time zone name.StringgetDisplayTimeZone(TimeZone tz)Returns a translated time zone name.static OraDisplayLocaleInfogetInstance(Locale transLocale)Constructs or reuses an instance of theOraDisplayLocaleInfoclass associated with the translation locale.static OraDisplayLocaleInfogetInstance(Locale transLocale, Locale defLocale)Constructs or reuses an instance of theOraDisplayLocaleInfoclass associated with the translation locale.LocalegetLocale()Returns the locale associated with this object.
-
-
-
Field Detail
-
SHORT
public static final int SHORT
Constant value to specify theSHORTformatting style.- See Also:
- Constant Field Values
-
LONG
public static final int LONG
Constant value to specify theLONGformatting style.- See Also:
- Constant Field Values
-
DEFAULT
public static final int DEFAULT
Constant value to specify theDEFAULTformatting style.- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocale
public Locale getLocale()
Returns the locale associated with this object. This locale is the translation locale, i.e. the locale (language) to which the display names are translated.- Returns:
- a Java
Localeobject
-
getInstance
public static OraDisplayLocaleInfo getInstance(Locale transLocale)
Constructs or reuses an instance of theOraDisplayLocaleInfoclass associated with the translation locale.- Parameters:
transLocale- a translation locale- Returns:
- an instance of the
OraDisplayLocaleInfoclass
-
getInstance
public static OraDisplayLocaleInfo getInstance(Locale transLocale, Locale defLocale)
Constructs or reuses an instance of theOraDisplayLocaleInfoclass associated with the translation locale. Uses the passed in default locale for fallback mechanism, if necessary.- Parameters:
transLocale- a translation localedefLocale- the default locale- Returns:
- an instance of
OraDisplayLocaleInfoclass
-
getDisplayLocale
public String getDisplayLocale(Locale locale)
Returns a translated locale name for the passed in locale parameter. The translation language used for translation is determined by the translation locale that was specified to retrieve an instance of this object.- Parameters:
locale- a locale to be translated- Returns:
- a translated locale name
-
getDisplayLocale
public String getDisplayLocale(String oraLanguage, String oraTerritory)
Returns a translated locale name for the passed in language/territory combination.- Parameters:
oraLanguage- an Oracle language nameoraTerritory- an Oracle territory name- Returns:
- a translated locale name
-
getDisplayLanguage
public String getDisplayLanguage(Locale locale)
Returns a translated language name.- Parameters:
locale- a locale that includes the language to be translated- Returns:
- a translated language name
-
getDisplayLanguage
public String getDisplayLanguage(String language)
Returns a translated language name.- Parameters:
language- an ISO based or Oracle language name- Returns:
- a translated language name
-
getDisplayCountry
public String getDisplayCountry(Locale locale)
Returns a translated country or territory name.- Parameters:
locale- a locale that includes the country to be translated- Returns:
- a translated country name
-
getDisplayCountry
public String getDisplayCountry(String country)
Returns a translated country or territory name.- Parameters:
country- an ISO based or Oracle country name to be translated- Returns:
- a translated country name
-
getDisplayTerritory
public String getDisplayTerritory(String territory)
Returns a translated country or territory name.- Parameters:
territory- a country name to be translated- Returns:
- a translated country name
-
getDisplayTimeZone
public String getDisplayTimeZone(TimeZone tz)
Returns a translated time zone name.If the translation is not found, the return value is composed by using the return value of the
getRawOffsetmethod in the form of(UTCSHH:MM)whereSrepresents the sign of the value,HHrepresents the hours of the offset, andMIrepresents the minutes of the offset.- Parameters:
tz- a time zone to be translated- Returns:
- a translated time zone name
-
getDisplayTimeZone
public String getDisplayTimeZone(String tzs)
Returns a translated time zone name.- Parameters:
tzs- a Java based time zone ID to be translated. If the time zone ID is invalid,UTCis used- Returns:
- a translated time zone name
- See Also:
getDisplayTimeZone(TimeZone)
-
getDisplayTimeZone
public String getDisplayTimeZone(int style, TimeZone tz)
Returns a translated time zone name.- Parameters:
style- the format style, for example,SHORT,LONG, orDEFAULTtz- a time zone to be translated- Returns:
- a translated time zone name
- See Also:
getDisplayTimeZone(TimeZone)
-
getDisplayTimeZone
public String getDisplayTimeZone(int style, String tzs)
Returns a translated time zone name.- Parameters:
style- the format style, for example,SHORT,LONG, orDEFAULTtzs- a Java based time zone ID to be translated. If the time zone ID is invalid,UTCis used- Returns:
- a translated time zone name
- See Also:
getDisplayTimeZone(TimeZone)
-
getDisplayLinguisticSort
public String getDisplayLinguisticSort(String linguisticSort)
Returns a translated linguistic sorting name.- Parameters:
linguisticSort- an Oracle linguistic sorting name to be translated- Returns:
- a translated linguistic sorting name
-
getDisplayCharacterSet
public String getDisplayCharacterSet(String charset)
Returns a translated character set name.- Parameters:
charset- a character set name to be translated. The name can either be an IANA or Oracle based name.- Returns:
- a translated character set name
-
getDisplayCurrency
public String getDisplayCurrency(String currencySymbol)
Returns a translated currency name.- Parameters:
currencySymbol- a character set symbol ISO 4217- Returns:
- a translated currency name
-
getCommonLocales
public static List getCommonLocales(Locale translocale)
Returns a list of the common locales sorted by the translated names. The common locale list is a subset of the "available" locales that the GDK supports.- Parameters:
translocale- the translation locale- Returns:
- a common
Localeobject list
-
getAvailableLanguages
public static String[][] getAvailableLanguages(Locale translocale)
Returns the available language IDs along with their corresponding display names sorted in the translated display name order.- Parameters:
translocale- the translation locale- Returns:
- a sorted 2-dimensional array of available languages. The returned array has the structure of: {{ "language ID 1", "language ID 2", "language ID 3", ... }, { "display name 1", "display name 2", "display name 3", ... }} The first element is an array of available language IDs sorted based on the order of their translated display names. The second element is an array of the corresponding translated display names. In other words, for the returned array lang[][], lang[0][i] is a language ID and lang[1][i] contains its corresponding translated display name.
-
getAvailableTerritories
public static String[][] getAvailableTerritories(Locale translocale)
Returns the available territory IDs along with their corresponding display names sorted in the display name order.- Parameters:
translocale- the translation locale- Returns:
- a sorted 2-dimensional array of available territories. The returned array has the structure of: {{ "territory ID 1", "territory ID 2", "territory ID 3", ... }, { "display name 1", "display name 2", "display name 3", ... }} The first element is an array of available territory IDs sorted based on the order of their translated display names. The second element is an array of the corresponding translated display names. In other words, for the returned array terr[][], terr[0][i] is a territory ID and terr[1][i] contains its corresponding translated display name.
-
-