Class LocaleUtil

java.lang.Object
com.aquima.interactions.foundation.text.LocaleUtil

public final class LocaleUtil extends Object
This class contains various utilities for creating and checking on locale strings.
Since:
6.2
Author:
F. van der Meer
  • Method Details

    • getLocale

      public static Locale getLocale(String code)
      This method creates a Locale based on the locale codes. Construct a locale from a language code or a language-country code. The locale can be constructed from a language code like: "en-GB" or a language and country code like "en-GB". The (optional) variant is ignored in the resulting locale.
      Parameters:
      code - lower case two-letter ISO-639 code optionally followed by a dash and a country code ISO-3166 optionally followed by variant string.
      Returns:
      The locale for the specified code.
      Since:
      6.2
    • isCountrySpecificLocale

      public static boolean isCountrySpecificLocale(Locale locale)
      This method checks whether this locale is a country specific locale. This means one can work with default number format settings when this locale is active.
      Parameters:
      locale - The locale for which to test its country settings for.
      Returns:
      a boolean indicating this is a country specific locale.
    • isValidCode

      public static boolean isValidCode(String codeString)
      Java specific language code validation.
      Parameters:
      codeString - The language code that needs to be validated.
      Returns:
      Boolean indicating if the code is valid.
    • isValidCode

      public static boolean isValidCode(String languageCode, String countryCode)
      This method checks whether the language code is correct and could be found within the system's locale information.
      Parameters:
      languageCode - The language code from the ISO-639 table.
      countryCode - The ISO-3166 country code.
      Returns:
      a boolean indicating the code is valid.