I18n

The Calyxo Panels component supports locale-dependent variants of panel definitions. This advanced feature may be used to define different view variants, depending on the user's locale settings.

A locale specifies a language code, and may additionally specify a country code. If it does so, it may also specify a variant code (see class java.util.Locale). The generalization of a locale is defined by stripping off the last and least significant code. For example, generalizing en_US leads to en. Generalizing en leads to an unspecified locale.

Localized panel definitions are collected into separate groups of <panels> elements. According to the locale properties, the <panels> element accepts attributes language, country and variant to specify a locale for the contained <panel> elements.

During instantiation, the process of searching attributes, subpanels, parameters and lists not only uses inheritance, but also generalization: if the attribute or element we're looking for is not available for the desired locale, the search proceeds using the generalized locale. In particular, generalization is used:

Finally, let's consider some examples:

<panels>
  <panel name="/address.page" template="/WEB-INF/address.jsp">
    <param name="foo" value="bar"/>
  </panel>
</panels>

<panels language="de">
  <panel name="/address.page" template="/WEB-INF/address_de.jsp"/>
</panels>

Depending on the desired locale, instantiation of /address.page will use the appropriate definition. Generalization will cause parameter foo to be found when using a german locale.

<panels>
  <panel name="/base.page" template="/WEB-INF/base.jsp">
    ...
  </panel>

  <panel name="/derived.page" super="/base.page">
    ...
  </panel>
</panels>

<panels language="de">
  <panel name="/base.page">
    ...
  </panel>
</panels>

Depending on the desired locale, instantiation of /derived.page will use the appropriate definition of /base.page to inherit from. Furthermore, generalization will cause /WEB-INF/base.jsp to be identified as associated template.