Package de.businesscode.bcdui.web.i18n
Class I18n
java.lang.Object
de.businesscode.bcdui.web.i18n.I18n
Global i18n constants and helper class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Locale
the default locale if any other configuration locale is not configuredstatic final String
Cookie name storing the preferred languagestatic final String
JNDI configuration property for the default languagestatic final String
Implicit subject filter storing the language -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceBundle.Control
createResourceControl
(jakarta.servlet.ServletContext servletContext) create a control suitable for database or local messages file backed resource bundlestatic Locale
static Locale
retrieve currently set locale for given sessionstatic Locale
getUserLocale
(jakarta.servlet.http.HttpServletRequest request) static void
set locale for given session
-
Field Details
-
JNDI_PROPERTY_CONTEXT_LANG
JNDI configuration property for the default language- See Also:
-
HTTP_COOKIE_LANG
Cookie name storing the preferred language- See Also:
-
SUBJECT_FILTER_TYPE
Implicit subject filter storing the language- See Also:
-
DEFAULT_LOCALE
the default locale if any other configuration locale is not configured
-
-
Constructor Details
-
I18n
public I18n()
-
-
Method Details
-
createResourceControl
public static ResourceBundle.Control createResourceControl(jakarta.servlet.ServletContext servletContext) create a control suitable for database or local messages file backed resource bundle- Parameters:
servletContext
-- Returns:
- appropriate control implementation depending if bcd_i18n is enabled or not
- Throws:
BindingException
-
getDefaultContextLocale
- Returns:
- the default context locale as configured by
JNDI_PROPERTY_CONTEXT_LANG
or theDEFAULT_LOCALE
-
getLocale
retrieve currently set locale for given session- Parameters:
session
- , whch may be nulldefaultLocale
-- Returns:
- currently set locale or the defaultLocale
-
getUserLocale
- Returns:
- currently active language for this user via session or request, if no session is available or no explicit language has been set, we guess from client information, and fallback to default language as per configuration.
-
setLocale
set locale for given session- Parameters:
session
-locale
-
-