Package lumis.portal.localization
Class LocaleUtilInternal
- java.lang.Object
-
- lumis.portal.localization.LocaleUtilInternal
-
public final class LocaleUtilInternal extends java.lang.Object
Locale utility methods.- Since:
- 8.1.0
- Version:
- $Revision: 20891 $ $Date: 2018-01-15 14:33:52 -0200 (Mon, 15 Jan 2018) $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LOCALE_COOKIE_NAME
Locale cookie name.
-
Constructor Summary
Constructors Constructor Description LocaleUtilInternal()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.json.simple.JSONObject
extractJsonObject(LocaleConfig locale)
Transform Locale to JsonObject Example: { "label" : "português (Brasil)", "value" : "pt_BR" }static boolean
isCurrentLocaleValid(ChannelConfig channel)
Returns whether the session locale is valid for a given channel.static void
markSessionLocaleToBeUpdated(HttpServletRequest request)
Marks the session to have the locale updated.static void
markSessionLocaleUpdated(HttpServletRequest request)
Mark the session as having the locale updated.static java.util.Locale
selectLocale(HttpServletRequest request, ChannelConfig channel)
Returns the selected locale for a given channel and request.static void
setCookie(java.util.Locale locale, HttpServletRequest request, HttpServletResponse response)
Sets the locale cookie using the given locale as value.static boolean
shouldUpdateSessionLocale(HttpServletRequest request)
Returns whether the session locale should be updated.
-
-
-
Field Detail
-
LOCALE_COOKIE_NAME
public static final java.lang.String LOCALE_COOKIE_NAME
Locale cookie name.- Since:
- 8.1.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
selectLocale
public static java.util.Locale selectLocale(HttpServletRequest request, ChannelConfig channel) throws PortalException
Returns the selected locale for a given channel and request.- Parameters:
request
- the request.channel
- the channel.- Returns:
- the selected locale for a given channel and request.
- Throws:
PortalException
- Since:
- 8.1.0
-
setCookie
public static void setCookie(java.util.Locale locale, HttpServletRequest request, HttpServletResponse response)
Sets the locale cookie using the given locale as value.- Parameters:
locale
- the locale.request
- the request.response
- the response.- Since:
- 8.1.0
-
shouldUpdateSessionLocale
public static boolean shouldUpdateSessionLocale(HttpServletRequest request)
Returns whether the session locale should be updated.- Parameters:
request
- the request.- Returns:
- whether the session locale should be updated.
- Since:
- 8.1.0
-
markSessionLocaleToBeUpdated
public static void markSessionLocaleToBeUpdated(HttpServletRequest request)
Marks the session to have the locale updated.- Parameters:
request
- the request.- Since:
- 8.1.0
-
markSessionLocaleUpdated
public static void markSessionLocaleUpdated(HttpServletRequest request)
Mark the session as having the locale updated.- Parameters:
request
- the request.- Since:
- 8.1.0
-
isCurrentLocaleValid
public static boolean isCurrentLocaleValid(ChannelConfig channel) throws PortalException
Returns whether the session locale is valid for a given channel.- Parameters:
channel
- the channel.- Returns:
- whether the session locale is valid for a given channel.
- Throws:
PortalException
- Since:
- 8.1.0
-
extractJsonObject
public static org.json.simple.JSONObject extractJsonObject(LocaleConfig locale)
Transform Locale to JsonObject Example: { "label" : "português (Brasil)", "value" : "pt_BR" }- Parameters:
locale
-- Returns:
- Since:
- 8.1.0
-
-