Modifier and Type | Class and Description |
---|---|
(package private) class |
I18nToolT.CombinedResourceBundle
Combined resource bundle.
|
Constructor and Description |
---|
I18nToolT() |
Modifier and Type | Method and Description |
---|---|
static java.util.ResourceBundle |
combineBundle(boolean blFlagOverridePreviousValue,
java.util.ResourceBundle[] rb1dIncoming)
This method tries to combine different resource bundles into one.
From its logic, the returning is a new combined resource bundle, and the previous resource bundles in the parameter list would not be spoiled. |
protected static java.lang.String |
fallSafe(java.lang.String strIn)
A fall back for failure.
This method is just for I18nToolT, I18nToolP && I18nToolE. |
static java.util.ResourceBundle |
getBundle(java.lang.String strBaseName)
Gets resource bundle according to the classpath base name.
|
static java.util.ResourceBundle |
getBundle(java.lang.String strBaseName,
java.util.Locale locale)
Gets resource bundle according to the classpath base name and locale.
|
static java.util.ResourceBundle[] |
getBundleArray(java.lang.String strBaseName,
int intCountMin,
java.util.Locale[] locale1d)
Gets resource bundles according to given locales.
The resource bundles is ordered by the order of locales. A resource bundle of default locale is got if the corresponding locale is NULL or bad. At least get min-count number of resource bundles if the number of given locales is not enough. |
static java.util.ResourceBundle[] |
getBundleArray(java.lang.String strBaseName,
java.util.Locale[] locale1d)
Gets resource bundles according to given locales.
The resource bundles is ordered by the order of locales. A resource bundle of default locale is got if the corresponding locale is NULL or bad. |
static java.util.Locale |
getDefaultLocale()
Gets the current value of the default locale for this instance of the
Java Virtual Machine.
|
static java.util.Locale |
getLocale(java.lang.String strLanguage)
Getting a locale with appointed language.
|
static java.util.Locale |
getLocale(java.lang.String strLanguage,
java.lang.String strLocation)
Getting a locale with appointed language and location.
|
static java.util.Locale |
getLocale(java.lang.String strLanguage,
java.lang.String strLocation,
java.lang.String strVariant)
Getting a locale with appointed language, location and variant.
|
static java.lang.String |
getString(java.util.ResourceBundle rb,
java.lang.String strKey)
Generates the content string according to the key and resource bundle.
|
static java.lang.String |
getString(java.util.ResourceBundle rb,
java.lang.String strKey,
java.lang.Object[] o1dArgs)
Generates the content string according to the key and resource bundle,
then format according to the third argument.
|
static boolean |
languageEqual(java.util.Locale locale1,
java.util.Locale locale2)
Checks whether the 2 languages in the 2 given locales equal.
|
static boolean |
locationEqual(java.util.Locale locale1,
java.util.Locale locale2)
Checks whether the 2 locations in the 2 given locales equal.
|
static boolean |
variantEqual(java.util.Locale locale1,
java.util.Locale locale2)
Checks whether the 2 variants in the 2 given locales equal.
|
protected static final java.lang.String fallSafe(java.lang.String strIn)
strIn
- - Incoming key text.public static java.util.ResourceBundle combineBundle(boolean blFlagOverridePreviousValue, java.util.ResourceBundle[] rb1dIncoming) throws java.io.IOException, java.lang.NullPointerException, java.lang.Exception
blFlagOverridePreviousValue
- - A boolean flag that indicates override or NOT override the
previous value.rb1dIncoming
- - Incoming resource bundle.java.io.IOException
- .java.lang.NullPointerException
- .java.lang.Exception
- .public static java.util.ResourceBundle getBundle(java.lang.String strBaseName) throws java.lang.NullPointerException, java.util.MissingResourceException
strBaseName
- - The base name of required resource bundle.java.lang.NullPointerException
- - While the base name is NULL.java.util.MissingResourceException
- - If no resource bundle for the specified base name can be
found.public static java.util.ResourceBundle getBundle(java.lang.String strBaseName, java.util.Locale locale) throws java.lang.NullPointerException, java.util.MissingResourceException
strBaseName
- - The base name of required resource bundle.locale
- - This tool function searches for resource bundle which fits
this locale.java.lang.NullPointerException
- .java.util.MissingResourceException
- .public static java.util.ResourceBundle[] getBundleArray(java.lang.String strBaseName, java.util.Locale[] locale1d)
strBaseName
- - Base name of resource bundle.locale1d
- - Demanded locales.public static java.util.ResourceBundle[] getBundleArray(java.lang.String strBaseName, int intCountMin, java.util.Locale[] locale1d)
strBaseName
- - Base name of resource bundle.intCountMin
- - The minimum count of resource bundles to get.locale1d
- - Demanded locales.public static java.util.Locale getLocale(java.lang.String strLanguage)
strLanguage
- - Language of demanded locale, such as Chinese(zh) and
English(en).public static java.util.Locale getLocale(java.lang.String strLanguage, java.lang.String strLocation)
strLanguage
- - Language of demanded locale, such as Chinese(zh) and
English(en).strLocation
- - Language of demanded locale in the world, such as China(cn)
and USA(us).public static java.util.Locale getLocale(java.lang.String strLanguage, java.lang.String strLocation, java.lang.String strVariant)
strLanguage
- - Language of demanded locale, such as Chinese(zh) and
English(en).strLocation
- - Location of demanded locale in the world, such as
China-mainland or Chinese-Simplify areas(cn/CN) and
USA(us/US).strVariant
- Variant vendor and browser specific code of demanded locale.public static java.util.Locale getDefaultLocale()
public static java.lang.String getString(java.util.ResourceBundle rb, java.lang.String strKey) throws java.lang.NullPointerException, java.util.MissingResourceException, java.lang.ClassCastException
rb
- - Incoming resource bundle which contains the required string.strKey
- - Key string of the required contents in the resource bundle.java.lang.NullPointerException
- - While:java.util.MissingResourceException
- - If no object for the given key can be found.java.lang.ClassCastException
- - If the object found for the given key is not a string.public static java.lang.String getString(java.util.ResourceBundle rb, java.lang.String strKey, java.lang.Object[] o1dArgs) throws java.lang.NullPointerException, java.util.MissingResourceException, java.lang.ClassCastException
rb
- - Incoming resource bundle which contains the required string.strKey
- - Key string of the required contents in the resource bundle.o1dArgs
- - The arguments which will be filled into the blanks of the
main string.java.lang.NullPointerException
- - While:java.util.MissingResourceException
- - If no object for the given key can be found.java.lang.ClassCastException
- - If the object found for the given key is not a string.public static boolean languageEqual(java.util.Locale locale1, java.util.Locale locale2)
locale1
- - One locale.locale2
- - Another locale.public static boolean locationEqual(java.util.Locale locale1, java.util.Locale locale2)
locale1
- - One locale.locale2
- - Another locale.public static boolean variantEqual(java.util.Locale locale1, java.util.Locale locale2)
locale1
- - One locale.locale2
- - Another locale.