Liferay 7.0-ga1 portal-impl

com.liferay.portal.language
Class UnicodeLanguageImpl

java.lang.Object
  extended by com.liferay.portal.language.UnicodeLanguageImpl
All Implemented Interfaces:
com.liferay.portal.kernel.language.UnicodeLanguage

public class UnicodeLanguageImpl
extends Object
implements com.liferay.portal.kernel.language.UnicodeLanguage

Provides various translation related functionalities in unicode for language keys specified in portlet configurations and portal resource bundles.

See Also:
LanguageImpl

Constructor Summary
UnicodeLanguageImpl()
           
 
Method Summary
 String format(javax.servlet.http.HttpServletRequest request, String pattern, com.liferay.portal.kernel.language.LanguageWrapper argument)
          Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale.
 String format(javax.servlet.http.HttpServletRequest request, String pattern, com.liferay.portal.kernel.language.LanguageWrapper[] arguments)
          Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale.
 String format(javax.servlet.http.HttpServletRequest request, String pattern, com.liferay.portal.kernel.language.LanguageWrapper[] arguments, boolean translateArguments)
          Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale.
 String format(javax.servlet.http.HttpServletRequest request, String pattern, com.liferay.portal.kernel.language.LanguageWrapper argument, boolean translateArguments)
          Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale.
 String format(javax.servlet.http.HttpServletRequest request, String pattern, Object argument)
          Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale.
 String format(javax.servlet.http.HttpServletRequest request, String pattern, Object[] arguments)
          Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale.
 String format(javax.servlet.http.HttpServletRequest request, String pattern, Object[] arguments, boolean translateArguments)
          Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale.
 String format(javax.servlet.http.HttpServletRequest request, String pattern, Object argument, boolean translateArguments)
          Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale.
 String format(Locale locale, String pattern, Object argument)
          Returns the translated pattern in unicode using the locale or, if the locale is not available, the server's default locale.
 String format(Locale locale, String pattern, Object[] arguments)
          Returns the translated pattern in unicode using the locale or, if the locale is not available, the server's default locale.
 String format(Locale locale, String pattern, Object[] arguments, boolean translateArguments)
          Returns the translated pattern in unicode using the locale or, if the locale is not available, the server's default locale.
 String format(Locale locale, String pattern, Object argument, boolean translateArguments)
          Returns the translated pattern in unicode using the locale or, if the locale is not available, the server's default locale.
 String format(ResourceBundle resourceBundle, String pattern, Object argument)
          Returns the translated pattern in the resource bundle in unicode or, if the resource bundle is not available, the untranslated key in unicode.
 String format(ResourceBundle resourceBundle, String pattern, Object[] arguments)
          Returns the translated pattern in the resource bundle in unicode or, if the resource bundle is not available, the untranslated key in unicode.
 String format(ResourceBundle resourceBundle, String pattern, Object[] arguments, boolean translateArguments)
          Returns the translated pattern in the resource bundle in unicode or, if the resource bundle is not available, the untranslated key in unicode.
 String format(ResourceBundle resourceBundle, String pattern, Object argument, boolean translateArguments)
          Returns the translated pattern in the resource bundle in unicode or, if the resource bundle is not available, the untranslated key in unicode.
 String get(javax.servlet.http.HttpServletRequest request, String key)
          Returns the key's translation from the portlet configuration in unicode, or from the portal's resource bundle if the portlet configuration is unavailable.
 String get(javax.servlet.http.HttpServletRequest request, String key, String defaultValue)
          Returns the key's translation from the portlet configuration in unicode, or from the portal's resource bundle if the portlet configuration is unavailable.
 String get(Locale locale, String key)
          Returns the key's translation from the portal's resource bundle in unicode.
 String get(Locale locale, String key, String defaultValue)
          Returns the key's translation from the portal's resource bundle in unicode.
 String get(ResourceBundle resourceBundle, String key)
          Returns the key's translation from the resource bundle in unicode.
 String get(ResourceBundle resourceBundle, String key, String defaultValue)
          Returns the key's translation from the resource bundle in unicode.
 String getTimeDescription(javax.servlet.http.HttpServletRequest request, long milliseconds)
          Returns an exact localized description in unicode of the time interval (in milliseconds) in the largest unit possible.
 String getTimeDescription(javax.servlet.http.HttpServletRequest request, Long milliseconds)
          Returns an exact localized description in unicode of the time interval (in milliseconds) in the largest unit possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnicodeLanguageImpl

public UnicodeLanguageImpl()
Method Detail

format

public String format(javax.servlet.http.HttpServletRequest request,
                     String pattern,
                     com.liferay.portal.kernel.language.LanguageWrapper argument)
Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholder (e.g. {0}) is replaced with the argument, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
argument - the single argument to be substituted into the pattern and translated, if possible
Returns:
the translated pattern in unicode, with the argument substituted in for the pattern's placeholder

format

public String format(javax.servlet.http.HttpServletRequest request,
                     String pattern,
                     com.liferay.portal.kernel.language.LanguageWrapper argument,
                     boolean translateArguments)
Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholder (e.g. {0}) is replaced with the argument, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
argument - the single argument to be substituted into the pattern and translated, if possible
translateArguments - whether the argument is translated
Returns:
the translated pattern in unicode, with the argument substituted in for the pattern's placeholder

format

public String format(javax.servlet.http.HttpServletRequest request,
                     String pattern,
                     com.liferay.portal.kernel.language.LanguageWrapper[] arguments)
Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholders (e.g. {0}, {1}, {2}, etc.) are replaced with the arguments, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
arguments - the arguments to be substituted into the pattern and translated, if possible
Returns:
the translated pattern in unicode, with the arguments substituted in for the pattern's placeholders

format

public String format(javax.servlet.http.HttpServletRequest request,
                     String pattern,
                     com.liferay.portal.kernel.language.LanguageWrapper[] arguments,
                     boolean translateArguments)
Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholders (e.g. {0}, {1}, {2}, etc.) are replaced with the arguments, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
arguments - the arguments to be substituted into the pattern
translateArguments - whether the arguments are translated
Returns:
the translated pattern in unicode, with the arguments substituted in for the pattern's placeholders

format

public String format(javax.servlet.http.HttpServletRequest request,
                     String pattern,
                     Object argument)
Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholder (e.g. {0}) is replaced with the argument, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
argument - the single argument to be substituted into the pattern and translated, if possible
Returns:
the translated pattern in unicode, with the argument substituted in for the pattern's placeholder

format

public String format(javax.servlet.http.HttpServletRequest request,
                     String pattern,
                     Object argument,
                     boolean translateArguments)
Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholder (e.g. {0}) is replaced with the argument, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
argument - the single argument to be substituted into the pattern and translated, if possible
translateArguments - whether the argument is translated
Returns:
the translated pattern in unicode, with the argument substituted in for the pattern's placeholder

format

public String format(javax.servlet.http.HttpServletRequest request,
                     String pattern,
                     Object[] arguments)
Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholders (e.g. {0}, {1}, {2}, etc.) are replaced with the arguments, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
arguments - the arguments to be substituted into the pattern and translated, if possible
Returns:
the translated pattern in unicode, with the arguments substituted in for the pattern's placeholders

format

public String format(javax.servlet.http.HttpServletRequest request,
                     String pattern,
                     Object[] arguments,
                     boolean translateArguments)
Returns the translated pattern in unicode using the current request's locale or, if the current request locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholders (e.g. {0}, {1}, {2}, etc.) are replaced with the arguments, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
arguments - the arguments to be substituted into the pattern
translateArguments - whether the arguments are translated
Returns:
the translated pattern in unicode, with the arguments substituted in for the pattern's placeholders

format

public String format(Locale locale,
                     String pattern,
                     Object argument)
Returns the translated pattern in unicode using the locale or, if the locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholder (e.g. {0}) is replaced with the argument, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
locale - the locale to translate to
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
argument - the argument to be substituted into the pattern
Returns:
the translated pattern in unicode, with the argument substituted in for the pattern's placeholder

format

public String format(Locale locale,
                     String pattern,
                     Object argument,
                     boolean translateArguments)
Returns the translated pattern in unicode using the locale or, if the locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholder (e.g. {0}) is replaced with the argument, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
locale - the locale to translate to
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
argument - the argument to be substituted into the pattern
translateArguments - whether the argument is translated
Returns:
the translated pattern in unicode, with the argument substituted in for the pattern's placeholder

format

public String format(Locale locale,
                     String pattern,
                     Object[] arguments)
Returns the translated pattern in unicode using the locale or, if the locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholders (e.g. {0}, {1}, {2}, etc.) are replaced with the arguments, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
locale - the locale to translate to
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
arguments - the arguments to be substituted into the pattern
Returns:
the translated pattern in unicode, with the arguments substituted in for the pattern's placeholders

format

public String format(Locale locale,
                     String pattern,
                     Object[] arguments,
                     boolean translateArguments)
Returns the translated pattern in unicode using the locale or, if the locale is not available, the server's default locale. If a translation for a given key does not exist, this method returns the requested key as the translation.

The substitute placeholders (e.g. {0}, {1}, {2}, etc.) are replaced with the arguments, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
locale - the locale to translate to
pattern - the key to look up in the current locale's resource file. The key follows the standard Java resource specification.
arguments - the arguments to be substituted into the pattern
translateArguments - whether the arguments are translated
Returns:
the translated pattern in unicode, with the arguments substituted in for the pattern's placeholders

format

public String format(ResourceBundle resourceBundle,
                     String pattern,
                     Object argument)
Returns the translated pattern in the resource bundle in unicode or, if the resource bundle is not available, the untranslated key in unicode. If a translation for a given key does not exist, this method returns the requested key in unicode as the translation.

The substitute placeholder (e.g. {0}) is replaced with the argument, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
resourceBundle - the requested key's resource bundle
pattern - the key to look up in the resource bundle. The key follows the standard Java resource specification.
argument - the argument to be substituted into the pattern
Returns:
the translated pattern in unicode, with the argument substituted in for the pattern's placeholder

format

public String format(ResourceBundle resourceBundle,
                     String pattern,
                     Object argument,
                     boolean translateArguments)
Returns the translated pattern in the resource bundle in unicode or, if the resource bundle is not available, the untranslated key in unicode. If a translation for a given key does not exist, this method returns the requested key in unicode as the translation.

The substitute placeholder (e.g. {0}) is replaced with the argument, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
resourceBundle - the requested key's resource bundle
pattern - the key to look up in the resource bundle. The key follows the standard Java resource specification.
argument - the argument to be substituted into the pattern
translateArguments - whether the argument is translated
Returns:
the translated pattern in unicode, with the argument substituted in for the pattern's placeholder

format

public String format(ResourceBundle resourceBundle,
                     String pattern,
                     Object[] arguments)
Returns the translated pattern in the resource bundle in unicode or, if the resource bundle is not available, the untranslated key in unicode. If a translation for a given key does not exist, this method returns the requested key in unicode as the translation.

The substitute placeholders (e.g. {0}, {1}, {2}, etc.) are replaced with the arguments, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
resourceBundle - the requested key's resource bundle
pattern - the key to look up in the resource bundle. The key follows the standard Java resource specification.
arguments - the arguments to be substituted into the pattern
Returns:
the translated pattern in unicode, with the arguments substituted in for the pattern's placeholder

format

public String format(ResourceBundle resourceBundle,
                     String pattern,
                     Object[] arguments,
                     boolean translateArguments)
Returns the translated pattern in the resource bundle in unicode or, if the resource bundle is not available, the untranslated key in unicode. If a translation for a given key does not exist, this method returns the requested key in unicode as the translation.

The substitute placeholders (e.g. {0}, {1}, {2}, etc.) are replaced with the arguments, following the standard Java ResourceBundle notion of index based substitution.

Specified by:
format in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
resourceBundle - the requested key's resource bundle
pattern - the key to look up in the resource bundle. The key follows the standard Java resource specification.
arguments - the arguments to be substituted into the pattern
translateArguments - whether the arguments are translated
Returns:
the translated pattern in unicode, with the arguments substituted in for the pattern's placeholder

get

public String get(javax.servlet.http.HttpServletRequest request,
                  String key)
Returns the key's translation from the portlet configuration in unicode, or from the portal's resource bundle if the portlet configuration is unavailable.

Specified by:
get in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the key's context and locale
key - the translation key
Returns:
the key's translation in unicode, or the unicode key if the translation is unavailable

get

public String get(javax.servlet.http.HttpServletRequest request,
                  String key,
                  String defaultValue)
Returns the key's translation from the portlet configuration in unicode, or from the portal's resource bundle if the portlet configuration is unavailable.

Specified by:
get in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the key's context and locale
key - the translation key
defaultValue - the value to return if there is no matching translation
Returns:
the key's translation in unicode, or the default value in unicode if the translation is unavailable

get

public String get(Locale locale,
                  String key)
Returns the key's translation from the portal's resource bundle in unicode.

Specified by:
get in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
locale - the key's locale
key - the translation key
Returns:
the key's translation in unicode

get

public String get(Locale locale,
                  String key,
                  String defaultValue)
Returns the key's translation from the portal's resource bundle in unicode.

Specified by:
get in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
locale - the key's locale
key - the translation key
defaultValue - the value to return if there is no matching translation
Returns:
the key's translation in unicode, or the default value in unicode if the translation is unavailable

get

public String get(ResourceBundle resourceBundle,
                  String key)
Returns the key's translation from the resource bundle in unicode.

Specified by:
get in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
resourceBundle - the requested key's resource bundle
key - the translation key
Returns:
the key's translation in unicode

get

public String get(ResourceBundle resourceBundle,
                  String key,
                  String defaultValue)
Returns the key's translation from the resource bundle in unicode.

Specified by:
get in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
resourceBundle - the requested key's resource bundle
key - the translation key
defaultValue - the value to return if there is no matching translation
Returns:
the key's translation in unicode, or the default value in unicode if the translation is unavailable

getTimeDescription

public String getTimeDescription(javax.servlet.http.HttpServletRequest request,
                                 long milliseconds)
Returns an exact localized description in unicode of the time interval (in milliseconds) in the largest unit possible.

For example, the following time intervals would be converted to the following time descriptions, using the English locale:

Specified by:
getTimeDescription in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
milliseconds - the time interval in milliseconds to describe
Returns:
an exact localized description in unicode of the time interval in the largest unit possible

getTimeDescription

public String getTimeDescription(javax.servlet.http.HttpServletRequest request,
                                 Long milliseconds)
Returns an exact localized description in unicode of the time interval (in milliseconds) in the largest unit possible.

For example, the following time intervals would be converted to the following time descriptions, using the English locale:

Specified by:
getTimeDescription in interface com.liferay.portal.kernel.language.UnicodeLanguage
Parameters:
request - the request used to determine the current locale
milliseconds - the time interval in milliseconds to describe
Returns:
an exact localized description in unicode of the time interval in the largest unit possible

Liferay 7.0-ga1 portal-impl