Class LanguageImpl
- All Implemented Interfaces:
com.liferay.portal.kernel.language.Language,Serializable
You can disable translations by setting the
translations.disabled property to true in
portal.properties.
Depending on the context passed into these methods, the lookup might be limited to the portal's resource bundle (e.g. when only a locale is passed), or extended to include an individual portlet's resource bundle (e.g. when a request object is passed). A portlet's resource bundle overrides the portal's resources when both are present.
- Author:
- Brian Wing Shun Chan, Andrius Vitkauskas, Eduardo Lundgren
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReturns the translated pattern using the locale or, if the locale is not available, the server's default locale.Returns the translated pattern using the locale or, if the locale is not available, the server's default locale.Returns the translated pattern using the locale or, if the locale is not available, the server's default locale.Returns the translated pattern using the locale or, if the locale is not available, the server's default locale.Returns the translated pattern using the locale or, if the locale is not available, the server's default locale.format(ResourceBundle resourceBundle, String pattern, Object argument) Returns the translated pattern in the resource bundle or, if the resource bundle is not available, the untranslated key.format(ResourceBundle resourceBundle, String pattern, Object[] arguments) Returns the translated pattern in the resource bundle or, if the resource bundle is not available, the untranslated key.format(ResourceBundle resourceBundle, String pattern, Object[] arguments, boolean translateArguments) Returns the translated pattern in the resource bundle or, if the resource bundle is not available, the untranslated key.format(ResourceBundle resourceBundle, String pattern, Object argument, boolean translateArguments) Returns the translated pattern in the resource bundle or, if the resource bundle is not available, the untranslated key.format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, com.liferay.portal.kernel.language.LanguageWrapper argument) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, com.liferay.portal.kernel.language.LanguageWrapper[] arguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, com.liferay.portal.kernel.language.LanguageWrapper[] arguments, boolean translateArguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, com.liferay.portal.kernel.language.LanguageWrapper argument, boolean translateArguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, Object[] arguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, Object[] arguments, boolean translateArguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, Object argument, boolean translateArguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.formatStorageSize(double size, Locale locale) Returns the translated and formatted storage sizeReturns the key's translation from the portal's resource bundle.Returns the key's translation from the portal's resource bundle.get(ResourceBundle resourceBundle, String key) Returns the key's translation from the resource bundle.get(ResourceBundle resourceBundle, String key, String defaultValue) Returns the key's translation from the resource bundle.Returns the key's translation from the portlet configuration, or from the portal's resource bundle if the portlet configuration is unavailable.get(javax.servlet.http.HttpServletRequest httpServletRequest, ResourceBundle resourceBundle, String key) Returns the key's translation from the portlet configuration, or from the portal's resource bundle if the portlet configuration is unavailable.get(javax.servlet.http.HttpServletRequest httpServletRequest, ResourceBundle resourceBundle, String key, String defaultValue) Returns the locales configured for the portal.getAvailableLocales(long groupId) getBCP47LangTag(Locale locale) getBCP47LanguageId(Locale locale) getBCP47LanguageId(PortletRequest portletRequest) getBCP47LanguageId(javax.servlet.http.HttpServletRequest httpServletRequest) getCompanyAvailableLocales(long companyId) getLanguageId(Locale locale) Returns the language ID from the locale.getLanguageId(PortletRequest portletRequest) Returns the language ID that thePortletRequestis served with.getLanguageId(javax.servlet.http.HttpServletRequest httpServletRequest) Returns the language ID that the request is served with.longReturns the last time (in milliseconds) there was a change in the language's list, company, or group.Returns the locale associated with the language code.com.liferay.portal.kernel.resource.bundle.ResourceBundleLoadergetTimeDescription(Locale locale, long milliseconds) Returns an exact localized description of the time interval (in milliseconds) in the largest unit possible.getTimeDescription(Locale locale, long milliseconds, boolean approximate) Returns an approximate or exact localized description of the time interval (in milliseconds) in the largest unit possible.getTimeDescription(Locale locale, Long milliseconds) Returns an exact localized description of the time interval (in milliseconds) in the largest unit possible.getTimeDescription(javax.servlet.http.HttpServletRequest httpServletRequest, long milliseconds) Returns an exact localized description of the time interval (in milliseconds) in the largest unit possible.getTimeDescription(javax.servlet.http.HttpServletRequest httpServletRequest, long milliseconds, boolean approximate) Returns an approximate or exact localized description of the time interval (in milliseconds) in the largest unit possible.getTimeDescription(javax.servlet.http.HttpServletRequest httpServletRequest, Long milliseconds) Returns an exact localized description of the time interval (in milliseconds) in the largest unit possible.voidinit()booleanisAvailableLanguageCode(String languageCode) Returnstrueif the language code is configured to be available.booleanisAvailableLocale(long groupId, String languageId) Returnstrueif the language ID is configured to be available in the group.booleanisAvailableLocale(long groupId, Locale locale) Returnstrueif the locale is configured to be available in the group.booleanisAvailableLocale(String languageId) Returnstrueif the language ID is configured to be available.booleanisAvailableLocale(Locale locale) Returnstrueif the locale is configured to be available.booleanisBetaLocale(Locale locale) Returnstrueif the locale is configured to be a beta language.booleanisDuplicateLanguageCode(String languageCode) booleanisInheritLocales(long groupId) booleanisSameLanguage(Locale locale1, Locale locale2) process(Supplier<ResourceBundle> resourceBundleSupplier, Locale locale, String content) voidresetAvailableGroupLocales(long groupId) voidresetAvailableLocales(long companyId) voidupdateCookie(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Locale locale)
-
Constructor Details
-
LanguageImpl
public LanguageImpl()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet() -
format
public String format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, com.liferay.portal.kernel.language.LanguageWrapper argument) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.The lookup is done on the portlet configuration first, and if it's not found, it is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localepattern- 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, with the argument substituted in for the pattern's placeholder
-
format
public String format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, com.liferay.portal.kernel.language.LanguageWrapper argument, boolean translateArguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.The lookup is done on the portlet configuration first, and if it's not found, it is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localepattern- 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 possibletranslateArguments- whether the argument is translated- Returns:
- the translated pattern, with the argument substituted in for the pattern's placeholder
-
format
public String format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, com.liferay.portal.kernel.language.LanguageWrapper[] arguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.The lookup is done on the portlet configuration first, and if it's not found, it is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localepattern- 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, with the arguments substituted in for the pattern's placeholders
-
format
public String format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, com.liferay.portal.kernel.language.LanguageWrapper[] arguments, boolean translateArguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.The lookup is done on the portlet configuration first, and if it's not found, it is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localepattern- 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 patterntranslateArguments- whether the arguments are translated- Returns:
- the translated pattern, with the arguments substituted in for the pattern's placeholders
-
format
public String format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, Object argument) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.The lookup is done on the portlet configuration first, and if it's not found, it is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localepattern- 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, with the argument substituted in for the pattern's placeholder
-
format
public String format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, Object argument, boolean translateArguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.The lookup is done on the portlet configuration first, and if it's not found, it is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localepattern- 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 possibletranslateArguments- whether the argument is translated- Returns:
- the translated pattern, with the argument substituted in for the pattern's placeholder
-
format
public String format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, Object[] arguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.The lookup is done on the portlet configuration first, and if it's not found, it is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localepattern- 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, with the arguments substituted in for the pattern's placeholders
-
format
public String format(javax.servlet.http.HttpServletRequest httpServletRequest, String pattern, Object[] arguments, boolean translateArguments) Returns the translated pattern using the current request's locale or, if the current request locale is not available, the server's default locale.The lookup is done on the portlet configuration first, and if it's not found, it is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localepattern- 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 patterntranslateArguments- whether the arguments are translated- Returns:
- the translated pattern, with the arguments substituted in for the pattern's placeholders
-
format
Returns the translated pattern using the locale or, if the locale is not available, the server's default locale.The lookup is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale to translate topattern- 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, with the arguments substituted in for the pattern's placeholders
-
format
Returns the translated pattern using the locale or, if the locale is not available, the server's default locale.The lookup is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale to translate topattern- 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, with the argument substituted in for the pattern's placeholder
-
format
Returns the translated pattern using the locale or, if the locale is not available, the server's default locale.The lookup is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale to translate topattern- 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 patterntranslateArguments- whether the argument is translated- Returns:
- the translated pattern, with the argument substituted in for the pattern's placeholder
-
format
Returns the translated pattern using the locale or, if the locale is not available, the server's default locale.The lookup is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale to translate topattern- 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, with the arguments substituted in for the pattern's placeholders
-
format
Returns the translated pattern using the locale or, if the locale is not available, the server's default locale.The lookup is done on the portal's resource bundle. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale to translate topattern- 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 patterntranslateArguments- whether the arguments are translated- Returns:
- the translated pattern, with the arguments substituted in for the pattern's placeholders
-
format
Returns the translated pattern in the resource bundle or, if the resource bundle is not available, the untranslated key. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
resourceBundle- the requested key's resource bundlepattern- 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, 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 or, if the resource bundle is not available, the untranslated key. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
resourceBundle- the requested key's resource bundlepattern- 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 patterntranslateArguments- whether the argument is translated- Returns:
- the translated pattern, with the argument substituted in for the pattern's placeholder
-
format
Returns the translated pattern in the resource bundle or, if the resource bundle is not available, the untranslated key. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
resourceBundle- the requested key's resource bundlepattern- 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, 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 or, if the resource bundle is not available, the untranslated key. 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 JavaResourceBundlenotion of index based substitution.- Specified by:
formatin interfacecom.liferay.portal.kernel.language.Language- Parameters:
resourceBundle- the requested key's resource bundlepattern- 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 patterntranslateArguments- whether the arguments are translated- Returns:
- the translated pattern, with the arguments substituted in for the pattern's placeholder
-
formatStorageSize
Returns the translated and formatted storage size- Specified by:
formatStorageSizein interfacecom.liferay.portal.kernel.language.Language- Parameters:
size- the storage sizelocale- the locale to translate to- Returns:
- the translated storage size
-
get
public String get(javax.servlet.http.HttpServletRequest httpServletRequest, ResourceBundle resourceBundle, String key) Returns the key's translation from the portlet configuration, or from the portal's resource bundle if the portlet configuration is unavailable.- Specified by:
getin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the key's context and localeresourceBundle- the requested key's resource bundlekey- the translation key- Returns:
- the key's translation, or the key if the translation is unavailable
-
get
public String get(javax.servlet.http.HttpServletRequest httpServletRequest, ResourceBundle resourceBundle, String key, String defaultValue) - Specified by:
getin interfacecom.liferay.portal.kernel.language.Language
-
get
- Specified by:
getin interfacecom.liferay.portal.kernel.language.Language
-
get
public String get(javax.servlet.http.HttpServletRequest httpServletRequest, String key, String defaultValue) Returns the key's translation from the portlet configuration, or from the portal's resource bundle if the portlet configuration is unavailable.- Specified by:
getin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the key's context and localekey- the translation keydefaultValue- the value to return if there is no matching translation- Returns:
- the key's translation, or the default value if the translation is unavailable
-
get
Returns the key's translation from the portal's resource bundle.- Specified by:
getin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the key's localekey- the translation key- Returns:
- the key's translation
-
get
Returns the key's translation from the portal's resource bundle.- Specified by:
getin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the key's localekey- the translation keydefaultValue- the value to return if there is no matching translation- Returns:
- the key's translation, or the default value if the translation is unavailable
-
get
Returns the key's translation from the resource bundle.- Specified by:
getin interfacecom.liferay.portal.kernel.language.Language- Parameters:
resourceBundle- the requested key's resource bundlekey- the translation key- Returns:
- the key's translation
-
get
Returns the key's translation from the resource bundle.- Specified by:
getin interfacecom.liferay.portal.kernel.language.Language- Parameters:
resourceBundle- the requested key's resource bundlekey- the translation keydefaultValue- the value to return if there is no matching translation- Returns:
- the key's translation, or the default value if the translation is unavailable
-
getAvailableLocales
Returns the locales configured for the portal. Locales can be configured inportal.propertiesusing thelocalesandlocales.enabledkeys.- Specified by:
getAvailableLocalesin interfacecom.liferay.portal.kernel.language.Language- Returns:
- the locales configured for the portal
-
getAvailableLocales
- Specified by:
getAvailableLocalesin interfacecom.liferay.portal.kernel.language.Language
-
getBCP47LangTag
- Specified by:
getBCP47LangTagin interfacecom.liferay.portal.kernel.language.Language
-
getBCP47LanguageId
- Specified by:
getBCP47LanguageIdin interfacecom.liferay.portal.kernel.language.Language
-
getBCP47LanguageId
- Specified by:
getBCP47LanguageIdin interfacecom.liferay.portal.kernel.language.Language
-
getBCP47LanguageId
- Specified by:
getBCP47LanguageIdin interfacecom.liferay.portal.kernel.language.Language
-
getCompanyAvailableLocales
- Specified by:
getCompanyAvailableLocalesin interfacecom.liferay.portal.kernel.language.Language
-
getLanguageId
Returns the language ID that the request is served with. The language ID is returned as a language code (e.g.en) or a specific variant (e.g.en_GB).- Specified by:
getLanguageIdin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the language ID- Returns:
- the language ID that the request is served with
-
getLanguageId
Returns the language ID from the locale. The language ID is returned as a language code (e.g.en) or a specific variant (e.g.en_GB).- Specified by:
getLanguageIdin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale used to determine the language ID- Returns:
- the language ID from the locale
-
getLanguageId
Returns the language ID that thePortletRequestis served with. The language ID is returned as a language code (e.g.en) or a specific variant (e.g.en_GB).- Specified by:
getLanguageIdin interfacecom.liferay.portal.kernel.language.Language- Parameters:
portletRequest- the portlet request used to determine the language ID- Returns:
- the language ID that the portlet request is served with
-
getLastModified
public long getLastModified()Returns the last time (in milliseconds) there was a change in the language's list, company, or group.- Specified by:
getLastModifiedin interfacecom.liferay.portal.kernel.language.Language- Returns:
- the last moodified time in milliseconds
-
getLocale
- Specified by:
getLocalein interfacecom.liferay.portal.kernel.language.Language
-
getLocale
Returns the locale associated with the language code.- Specified by:
getLocalein interfacecom.liferay.portal.kernel.language.Language- Parameters:
languageCode- the code representation of a language (e.g.enanden_GB)- Returns:
- the locale associated with the language code
-
getResourceBundleLoader
public com.liferay.portal.kernel.resource.bundle.ResourceBundleLoader getResourceBundleLoader()- Specified by:
getResourceBundleLoaderin interfacecom.liferay.portal.kernel.language.Language
-
getSupportedLocales
- Specified by:
getSupportedLocalesin interfacecom.liferay.portal.kernel.language.Language
-
getTimeDescription
public String getTimeDescription(javax.servlet.http.HttpServletRequest httpServletRequest, long milliseconds) Returns an exact localized description 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:
- 1000 = 1 Second
- 1001 = 1001 Milliseconds
- 86400000 = 1 Day
- 86401000 = 86401 Seconds
- Specified by:
getTimeDescriptionin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localemilliseconds- the time interval in milliseconds to describe- Returns:
- an exact localized description of the time interval in the largest unit possible
-
getTimeDescription
public String getTimeDescription(javax.servlet.http.HttpServletRequest httpServletRequest, long milliseconds, boolean approximate) Returns an approximate or exact localized description of the time interval (in milliseconds) in the largest unit possible.Approximate descriptions round the time to the largest possible unit and ignores the rest. For example, using the English locale:
- Any time interval 1000-1999 = 1 Second
- Any time interval 86400000-172799999 = 1 Day
Otherwise, exact descriptions would follow a similar conversion pattern as below:
- 1000 = 1 Second
- 1001 = 1001 Milliseconds
- 86400000 = 1 Day
- 86401000 = 86401 Seconds
- Specified by:
getTimeDescriptionin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localemilliseconds- the time interval in milliseconds to describeapproximate- whether the time description is approximate- Returns:
- a localized description of the time interval in the largest unit possible
-
getTimeDescription
public String getTimeDescription(javax.servlet.http.HttpServletRequest httpServletRequest, Long milliseconds) Returns an exact localized description 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:
- 1000 = 1 Second
- 1001 = 1001 Milliseconds
- 86400000 = 1 Day
- 86401000 = 86401 Seconds
- Specified by:
getTimeDescriptionin interfacecom.liferay.portal.kernel.language.Language- Parameters:
httpServletRequest- the request used to determine the current localemilliseconds- the time interval in milliseconds to describe- Returns:
- an exact localized description of the time interval in the largest unit possible
-
getTimeDescription
Returns an exact localized description 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:
- 1000 = 1 Second
- 1001 = 1001 Milliseconds
- 86400000 = 1 Day
- 86401000 = 86401 Seconds
- Specified by:
getTimeDescriptionin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale used to determine the languagemilliseconds- the time interval in milliseconds to describe- Returns:
- an exact localized description of the time interval in the largest unit possible
-
getTimeDescription
Returns an approximate or exact localized description of the time interval (in milliseconds) in the largest unit possible.Approximate descriptions round the time to the largest possible unit and ignores the rest. For example, using the English locale:
- Any time interval 1000-1999 = 1 Second
- Any time interval 86400000-172799999 = 1 Day
Otherwise, exact descriptions would follow a similar conversion pattern as below:
- 1000 = 1 Second
- 1001 = 1001 Milliseconds
- 86400000 = 1 Day
- 86401000 = 86401 Seconds
- Specified by:
getTimeDescriptionin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale used to determine the languagemilliseconds- the time interval in milliseconds to describeapproximate- whether the time description is approximate- Returns:
- a localized description of the time interval in the largest unit possible
-
getTimeDescription
Returns an exact localized description 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:
- 1000 = 1 Second
- 1001 = 1001 Milliseconds
- 86400000 = 1 Day
- 86401000 = 86401 Seconds
- Specified by:
getTimeDescriptionin interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale used to determine the languagemilliseconds- the time interval in milliseconds to describe- Returns:
- an exact localized description of the time interval in the largest unit possible
-
init
public void init()- Specified by:
initin interfacecom.liferay.portal.kernel.language.Language
-
isAvailableLanguageCode
Returnstrueif the language code is configured to be available. Locales can be configured inportal.propertiesusing thelocalesandlocales.enabledkeys.- Specified by:
isAvailableLanguageCodein interfacecom.liferay.portal.kernel.language.Language- Parameters:
languageCode- the code representation of a language (e.g.enanden_GB) to search for- Returns:
trueif the language code is configured to be available;falseotherwise
-
isAvailableLocale
Returnstrueif the locale is configured to be available. Locales can be configured inportal.propertiesusing thelocalesandlocales.enabledkeys.- Specified by:
isAvailableLocalein interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale to search for- Returns:
trueif the locale is configured to be available;falseotherwise
-
isAvailableLocale
Returnstrueif the locale is configured to be available in the group.- Specified by:
isAvailableLocalein interfacecom.liferay.portal.kernel.language.Language- Parameters:
groupId- the primary key of the grouplocale- the locale to search for- Returns:
trueif the locale is configured to be available in the group;falseotherwise
-
isAvailableLocale
Returnstrueif the language ID is configured to be available in the group.- Specified by:
isAvailableLocalein interfacecom.liferay.portal.kernel.language.Language- Parameters:
groupId- the primary key of the grouplanguageId- the language ID to search for- Returns:
trueif the language ID is configured to be available in the group;falseotherwise
-
isAvailableLocale
Returnstrueif the language ID is configured to be available.- Specified by:
isAvailableLocalein interfacecom.liferay.portal.kernel.language.Language- Parameters:
languageId- the language ID to search for- Returns:
trueif the language ID is configured to be available;falseotherwise
-
isBetaLocale
Returnstrueif the locale is configured to be a beta language.- Specified by:
isBetaLocalein interfacecom.liferay.portal.kernel.language.Language- Parameters:
locale- the locale to search for- Returns:
trueif the locale is configured to be a beta language;falseotherwise
-
isDuplicateLanguageCode
- Specified by:
isDuplicateLanguageCodein interfacecom.liferay.portal.kernel.language.Language
-
isInheritLocales
public boolean isInheritLocales(long groupId) throws com.liferay.portal.kernel.exception.PortalException - Specified by:
isInheritLocalesin interfacecom.liferay.portal.kernel.language.Language- Throws:
com.liferay.portal.kernel.exception.PortalException
-
isSameLanguage
- Specified by:
isSameLanguagein interfacecom.liferay.portal.kernel.language.Language
-
process
public String process(Supplier<ResourceBundle> resourceBundleSupplier, Locale locale, String content) - Specified by:
processin interfacecom.liferay.portal.kernel.language.Language
-
resetAvailableGroupLocales
public void resetAvailableGroupLocales(long groupId) - Specified by:
resetAvailableGroupLocalesin interfacecom.liferay.portal.kernel.language.Language
-
resetAvailableLocales
public void resetAvailableLocales(long companyId) - Specified by:
resetAvailableLocalesin interfacecom.liferay.portal.kernel.language.Language
-
updateCookie
public void updateCookie(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Locale locale) - Specified by:
updateCookiein interfacecom.liferay.portal.kernel.language.Language
-