Class FlowableExpressionLocaleUtils


  • public class FlowableExpressionLocaleUtils
    extends 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 Detail

      • FlowableExpressionLocaleUtils

        public FlowableExpressionLocaleUtils()
    • Method Detail

      • getLocaleForLanguageTag

        public Locale getLocaleForLanguageTag​(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 List<Locale> getAvailableLocales()
        Gets a list of all available Locales. Example:{flwLocaleUtils.getAvailableLocales()}
        Returns:
        List of all available Locales.
      • getDefaultLocale

        public Locale getDefaultLocale()
        Returns the default Locale of the system. Can be used to gain default currency etc. Example: {flwLocaleUtils.getDefaultLocale()}
        Returns:
        The default Locale of the system.
      • getAllCountryCodes

        public List<String> getAllCountryCodes()
        Returns a list of all 2-letter ISO country codes. Example: #{flwLocaleUtils.getAllCountryCodes()}
        Returns:
        List of all country codes
      • getAllLanguageCodes

        public List<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 String getLanguageDisplayName​(String languageIsoCode,
                                             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 language
        displayLanguageTag - The target language to display the language in
        Returns:
        The display name corresponding to the language tag
      • getCountryDisplayName

        public String getCountryDisplayName​(String languageTag,
                                            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 country
        displayLanguageTag - The target language to display the country in
        Returns:
        The display name corresponding to the language tag
      • getAllLanguageDisplayNames

        public List<String> getAllLanguageDisplayNames​(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 List<String> getAllCountryDisplayNames​(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.