Class LocaleUtils

java.lang.Object
io.undertow.util.LocaleUtils

public class LocaleUtils extends Object
Utility methods for getting the locale from a request.
Author:
Stuart Douglas
  • Constructor Details

    • LocaleUtils

      public LocaleUtils()
  • Method Details

    • getLocaleFromString

      public static Locale getLocaleFromString(String localeString)
    • getLocalesFromHeader

      public static List<Locale> getLocalesFromHeader(String acceptLanguage)
      Parse a header string and return the list of locales that were found. If the header is empty or null then an empty list will be returned.
      Parameters:
      acceptLanguage - The Accept-Language header
      Returns:
      The list of locales, in order of preference
    • getLocalesFromHeader

      public static List<Locale> getLocalesFromHeader(List<String> acceptLanguage)
      Parse a header string and return the list of locales that were found. If the header is empty or null then an empty list will be returned.
      Parameters:
      acceptLanguage - The Accept-Language header
      Returns:
      The list of locales, in order of preference