Class LocaleUtils

java.lang.Object
com.e1c.langtool.external.LocaleUtils

public final class LocaleUtils extends Object
This class contains useful language codes and some static utility methods for working with locales based on string.
  • Field Details

  • Method Details

    • getCode

      public static String getCode(String locale)
      Returns the language code from the given locale.

      If format of the locale is wrong and doesn't contain separator between language code and region code ('-' is used as separator) this method returns the given locale.

      Parameters:
      locale - the locale which consists of language code and some other parts (for example - region: en-US)
      Returns:
      the language code
    • getRegion

      public static String getRegion(String locale)
      Returns the region code from the given locale.

      If format of the locale is wrong and doesn't contain separator between language code and region code ('-' is used as separator) this method returns the given locale.

      Parameters:
      locale - the locale which consists of language code and some other parts (for example - region: en-US)
      Returns:
      the region code