Class FlowableExpressionLocaleUtils
java.lang.Object
com.flowable.platform.expressions.FlowableExpressionLocaleUtils
public class FlowableExpressionLocaleUtils
extends java.lang.Object
Expression Bean Name: flwLocaleUtils
Provides utilities to work with locales, countries and languages.
All methods which accept a language tag must be supplied with a string consisting of the language code and the country,
e.g. "ch-DE", "en-US" etc.
-
Constructor Summary
Constructors Constructor Description FlowableExpressionLocaleUtils()
-
Method Summary
Modifier and Type Method Description java.util.List<java.lang.String>
getAllCountryCodes()
Returns a list of all 2-letter ISO country codes.java.util.List<java.lang.String>
getAllCountryDisplayNames(java.lang.String displayLanguageTag)
Returns a list of all country names in a certain language Example: #{flwLocaleUtils.getAllCountryDisplayNames('de-CH')}java.util.List<java.lang.String>
getAllLanguageCodes()
Returns a list of all ISO language codes, e.g.java.util.List<java.lang.String>
getAllLanguageDisplayNames(java.lang.String displayLanguageTag)
Returns a list of all language names in a certain language.java.util.List<java.util.Locale>
getAvailableLocales()
Gets a list of all availableLocale
s.java.lang.String
getCountryDisplayName(java.lang.String languageTag, java.lang.String displayLanguageTag)
Returns a single country name in a certain language, e.g.java.util.Locale
getDefaultLocale()
Returns the defaultLocale
of the system.java.lang.String
getLanguageDisplayName(java.lang.String languageIsoCode, java.lang.String displayLanguageTag)
Returns a single language name in a certain language, e.g.java.util.Locale
getLocaleForLanguageTag(java.lang.String languageTag)
Gets the Locale with the given language tag, e.g.
-
Constructor Details
-
FlowableExpressionLocaleUtils
public FlowableExpressionLocaleUtils()
-
-
Method Details
-
getLocaleForLanguageTag
public java.util.Locale getLocaleForLanguageTag(java.lang.String languageTag)Gets the Locale with the given language tag, e.g. "ch-DE". Please be aware that Example: #{flwLocaleUtils.getLocaleForLanguageTag('ch-DE')}- Parameters:
languageTag
- An existing language tag.- Returns:
- The locale corresponding to the language tag.
-
getAvailableLocales
public java.util.List<java.util.Locale> getAvailableLocales()Gets a list of all availableLocale
s. Example:{flwLocaleUtils.getAvailableLocales()}- Returns:
- List of all available Locales.
-
getDefaultLocale
public java.util.Locale getDefaultLocale()Returns the defaultLocale
of the system. Can be used to gain default currency etc. Example: {flwLocaleUtils.getDefaultLocale()}- Returns:
- The default
Locale
of the system.
-
getAllCountryCodes
public java.util.List<java.lang.String> getAllCountryCodes()Returns a list of all 2-letter ISO country codes. Example: #{flwLocaleUtils.getAllCountryCodes()}- Returns:
- List of all country codes
-
getAllLanguageCodes
public java.util.List<java.lang.String> getAllLanguageCodes()Returns a list of all ISO language codes, e.g. "de", NOT "de-CH". Example: #{flwLocaleUtils.getAllLanguageCodes()}- Returns:
- List of all language codes
-
getLanguageDisplayName
public java.lang.String getLanguageDisplayName(java.lang.String languageIsoCode, java.lang.String displayLanguageTag)Returns a single language name in a certain language, e.g. "German" or "Spanish". Example: #{flwLocaleUtils.getLanguageDisplayName('de-CH', 'en-US')}- Parameters:
languageIsoCode
- 2-letter ISO code of the languagedisplayLanguageTag
- The target language to display the language in- Returns:
- The display name corresponding to the language tag
-
getCountryDisplayName
public java.lang.String getCountryDisplayName(java.lang.String languageTag, java.lang.String displayLanguageTag)Returns a single country name in a certain language, e.g. "Switzerland" or "Germany". Example: #{flwLocaleUtils.getCountryDisplayName('de-CH', 'en-US')}- Parameters:
languageTag
- Language tag of the countrydisplayLanguageTag
- The target language to display the country in- Returns:
- The display name corresponding to the language tag
-
getAllLanguageDisplayNames
public java.util.List<java.lang.String> getAllLanguageDisplayNames(java.lang.String displayLanguageTag)Returns a list of all language names in a certain language. Example: #{flwLocaleUtils.getAllLanguageDisplayNames('de-CH')}- Parameters:
displayLanguageTag
- The language to display the language names in.- Returns:
- List of all language names.
-
getAllCountryDisplayNames
public java.util.List<java.lang.String> getAllCountryDisplayNames(java.lang.String displayLanguageTag)Returns a list of all country names in a certain language Example: #{flwLocaleUtils.getAllCountryDisplayNames('de-CH')}- Parameters:
displayLanguageTag
- The language to display the language names in.- Returns:
- List of all country names.
-