Package org.bgerp.app.l10n

# Class Localization

java.lang.Object
org.bgerp.app.l10n.Localization

public class Localization extends Object
A localization unit, loaded from l10n.xml for a plugin.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `FILE_NAME`
  `static final String`
  `LANG_DE`
  `static final String`
  `LANG_EN`
  `static final String`
  `LANG_RU`
  `static final String`
  `LANG_SYS`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static final String`
  `getLang()`
  Default UI language for open interface and the only one for others.
  `static String`
  `getLang(javax.servlet.http.HttpServletRequest request)`
  Called from JSP.
  `static Localization`
  `getLocalization(Plugin p)`
  Gets localization for the plugin.
  `static Localizer`
  `getLocalizer()`
  Localizer for kernel only to the language, taken from `getLang()`.
  `static Localizer`
  `getLocalizer(String toLang, String... pluginIds)`
  Retrieve localizer for a plugin.
  `static Localizer`
  `getLocalizer(String pluginId, javax.servlet.http.HttpServletRequest request)`
  Retrieves `Localizer` object for a single plugin.
  `static Localizer`
  `getLocalizer(javax.servlet.http.HttpServletRequest request)`
  Retrieves a Localizer for a plugin, using request URI.
  `static final String`
  `getSysLang()`
  Deprecated.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### FILE_NAME

    public static final String FILE_NAME
    See Also:
      - Constant Field Values

  - ### LANG_SYS

    public static final String LANG_SYS
    See Also:
      - Constant Field Values

  - ### LANG_RU

    public static final String LANG_RU

  - ### LANG_EN

    public static final String LANG_EN

  - ### LANG_DE

    public static final String LANG_DE

- ## Method Details

  - ### getLocalization

    public static Localization getLocalization(Plugin p)
    Gets localization for the plugin.
    Parameters:
      `p` - the plugin.
    Returns:
      localization if `FILE_NAME` exists for the plugin, or null if missing.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getLocalizer

    public static Localizer getLocalizer(javax.servlet.http.HttpServletRequest request)
    Retrieves a Localizer for a plugin, using request URI.
    Parameters:
      `request` - plugin ID is got out of getRequestURI().
    Returns:

  - ### getLang

    public static String getLang(javax.servlet.http.HttpServletRequest request)
    Called from JSP. Retrieves language from the request params or session. Once defined lang has persisted in the session attribute as well. If not found language is taken from configuration parameter 'lang'. If not defined there - returned 'ru'.
    Parameters:
      `request` -
    Returns:

  - ### getLang

    public static final String getLang()
    Default UI language for open interface and the only one for others. Calls `getLang(HttpServletRequest)` with 'null'.
    Returns:

  - ### getSysLang

    @Deprecated public static final String getSysLang()
    Deprecated.
    Old version of `getLang()`.
    Returns:

  - ### getLocalizer

    public static Localizer getLocalizer(String toLang, String... pluginIds)
    Retrieve localizer for a plugin. The localizer includes the following localizations: custom if exists, than for kernel and after for the plugin itself.
    Parameters:
      `toLang` - target language's ID: `LANG_RU`, `LANG_EN`, `LANG_DE`
      `pluginIds` - plugin IDs, null - for kernel

  - ### getLocalizer

    public static Localizer getLocalizer(String pluginId, javax.servlet.http.HttpServletRequest request)
    Retrieves `Localizer` object for a single plugin.
    Parameters:
      `pluginId` - plugin ID.
      `request` - used for getting target language in case of open interface.
    Returns:

  - ### getLocalizer

    public static Localizer getLocalizer()
    Localizer for kernel only to the language, taken from `getLang()`.
    Returns: