public class LocaleUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
getLocalizedNumber(double number)
Returns an internationalized String representation of the number using
the default locale.
|
static String |
getLocalizedNumber(double number,
Locale locale)
Returns an internationalized String representation of the number using
the specified locale.
|
static String |
getLocalizedNumber(long number)
Returns an internationalized String representation of the number using
the default locale.
|
static String |
getLocalizedNumber(long number,
Locale locale)
Returns an internationalized String representation of the number using
the specified locale.
|
static String |
getLocalizedString(String key)
Returns an internationalized string loaded from a resource bundle.
|
static String |
getLocalizedString(String key,
List<?> arguments)
Returns an internationalized string loaded from a resource bundle using
the locale specified by JiveGlobals.getLocale() substituting the passed
in arguments.
|
static String |
getLocalizedString(String key,
Locale locale)
Returns an internationalized string loaded from a resource bundle using
the passed in Locale.
|
static String |
getLocalizedString(String key,
Locale locale,
List arguments,
ResourceBundle bundle)
Returns an internationalized string loaded from a resource bundle using
the passed in Locale substituting the passed in arguments.
|
static String |
getLocalizedString(String key,
String pluginName)
Returns an internationalized string loaded from a resource bundle from the passed
in plugin.
|
static String |
getLocalizedString(String key,
String pluginName,
List arguments)
Returns an internationalized string loaded from a resource bundle from the passed
in plugin.
|
static String |
getLocalizedString(String key,
String pluginName,
List<?> arguments,
Locale locale,
boolean fallback)
Returns an internationalized string loaded from a resource bundle from
the passed in plugin, using the passed in Locale.
|
static ResourceBundle |
getPluginResourceBundle(String pluginName)
Retrieve the
ResourceBundle that is used with this plugin. |
static ResourceBundle |
getResourceBundle(String baseName,
Locale locale)
Returns the specified resource bundle, which is a properties file
that aids in localization of skins.
|
static String[][] |
getTimeZoneList()
Returns a list of all available time zone's as a String [][].
|
static String |
getTimeZoneName(String zoneID,
Locale locale)
Returns the display name for a time zone.
|
static Locale |
localeCodeToLocale(String localeCode)
Converts a locale string like "en", "en_US" or "en_US_win" to a Java
locale object.
|
public static Locale localeCodeToLocale(String localeCode)
localeCode
- the locale code for a Java locale. See the Locale
class for more details.public static String[][] getTimeZoneList()
The list of time zones attempts to be inclusive of all of the worlds zones while being as concise as possible. For "en" language locales the name is a friendly english name. For non-"en" language locales the standard JDK name is used for the given Locale. The GMT+/- time is also included for readability.
public static String getTimeZoneName(String zoneID, Locale locale)
zoneID
- the time zone to get the name for.locale
- the locale to use.public static ResourceBundle getResourceBundle(String baseName, Locale locale)
baseName
- the name of the resource bundle to load.locale
- the desired Locale.public static String getLocalizedString(String key)
key
- the key to use for retrieving the string from the
appropriate resource bundle.public static String getLocalizedString(String key, Locale locale)
key
- the key to use for retrieving the string from the
appropriate resource bundle.locale
- the locale to use for retrieving the appropriate
locale-specific string.public static String getLocalizedString(String key, List<?> arguments)
MessageFormat
class.key
- the key to use for retrieving the string from the
appropriate resource bundle.arguments
- a list of objects to use which are formatted, then
inserted into the pattern at the appropriate places.public static String getLocalizedString(String key, String pluginName)
key
- the key to use for retrieving the string from the
appropriate resource bundle.pluginName
- the name of the plugin to load the require resource bundle from.public static String getLocalizedString(String key, String pluginName, List arguments)
key
- the key to use for retrieving the string from the
appropriate resource bundle.pluginName
- the name of the plugin to load the require resource bundle from.arguments
- a list of objects to use which are formatted, then
inserted into the pattern at the appropriate places.public static String getLocalizedString(String key, String pluginName, List<?> arguments, Locale locale, boolean fallback)
key
- the key to use for retrieving the string from the appropriate
resource bundle.pluginName
- the name of the plugin to load the require resource bundle
from.arguments
- a list of objects to use which are formatted, then inserted
into the pattern at the appropriate places.locale
- the locale to use for retrieving the appropriate
locale-specific string.fallback
- if true, the global locale used by Openfire will be
used if the requested locale is not available)public static ResourceBundle getPluginResourceBundle(String pluginName) throws Exception
ResourceBundle
that is used with this plugin.pluginName
- the name of the plugin.Exception
- thrown if an exception occurs.public static String getLocalizedString(String key, Locale locale, List arguments, ResourceBundle bundle)
MessageFormat
class.key
- the key to use for retrieving the string from the
appropriate resource bundle.locale
- the locale to use for retrieving the appropriate
locale-specific string.arguments
- a list of objects to use which are formatted, then
inserted into the pattern at the appropriate places.bundle
- The resource bundle from which to return the localized
string.public static String getLocalizedNumber(long number)
number
- the number to format.public static String getLocalizedNumber(long number, Locale locale)
number
- the number to format.locale
- the locale to use for formatting.public static String getLocalizedNumber(double number)
number
- the number to format.public static String getLocalizedNumber(double number, Locale locale)
number
- the number to format.locale
- the locale to use for formatting.Copyright © 2003-2008 Jive Software.