@StableMinor(version="12.5", sinceVersion="4.0") public abstract class LocaleUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
LOCALE_ATTRIBUTE_NAME |
Constructor and Description |
---|
LocaleUtil() |
Modifier and Type | Method and Description |
---|---|
static Locale |
fromRequest(HttpServletRequest request)
Returns the locale requested by the given
HttpServletRequest , or the
default locale if none was specified in the request. |
static Locale |
fromRequest(HttpServletRequest request,
boolean fallbackToDefault)
Returns the locale requested by the given
HttpServletRequest . |
static Locale |
fromString(String locale)
Returns the locale represented by the given string.
|
static Locale |
FromString(String locale)
Deprecated.
since 8.1.0 replaced by
fromString(String) . |
static Locale |
fromXMLLang(String xmlLang)
Returns the locale corresponding to a String following XML lang syntax
(e.g.: en-US).
|
public static final String LOCALE_ATTRIBUTE_NAME
@Deprecated public static Locale FromString(String locale) throws PortalException
fromString(String)
.PortalException
public static Locale fromString(String locale) throws PortalException
For more information, refer to Locale
.
locale
- the locale string.PortalException
Locale.Locale(String, String, String)
public static Locale fromXMLLang(String xmlLang)
xmlLang
- the XML lang value, according to the
RFC3066.IllegalArgumentException
- if xmlLang is null
or is
an invalid locale identifier.public static Locale fromRequest(HttpServletRequest request) throws PortalException
HttpServletRequest
, or the
default locale if none was specified in the request.request
- the request.PortalException
public static Locale fromRequest(HttpServletRequest request, boolean fallbackToDefault) throws PortalException
HttpServletRequest
.request
- the request.fallbackToDefault
- if true
the default locale
is returned instead of null
when no locale is specified in the request.fallbackToDefault
is true
or returns null
if it is false
.PortalException
LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.