Class Locales

java.lang.Object
com.aoapps.lang.i18n.Locales

public final class Locales extends Object
Convenience static access to more locales than provided by the stock Locale class.
Author:
AO Industries, Inc.
  • Field Details

  • Method Details

    • getCachedLocale

      public static Locale getCachedLocale(String language, String country, String variant)
      Gets a cached locale instance.
    • parseLocale

      public static Locale parseLocale(String locale)
      Parses locales from their toString representation. Language, country, and variant may be separated by underscore "_" or hyphen "-". Language is converted to lowercase. Country is converted to uppercase. Caches locales so the same instance will be returned for each combination of language, country, and variant.

      Locales are currently cached forever. Malicious external sources of locales could fill the heap space, so protect against this if needed.

    • isRightToLeft

      public static boolean isRightToLeft(Locale locale)
      Determines if the provided locale should be displayed from right to left.