Skip to main content
Version: 8.2405.x.x RR

Language support

Language support (translations) is required if the login page generator directly transforms the GUI descriptor and makes unaltered use of the label attributes. Either nevisAuth or nevisLogRend can perform translations. The mechanism (handled by the AuthEngine) works as follows:

  • Check, if the language support is enabled (useLiteralDictionary=true).

  • Detect the language required by the user. The following sources are checked:

    • Input arguments (i.e., URL query arguments or form post data) for the attribute language (inputLanguageAttribute=language).
    • Language setting in session.
    • If inputLanguageCookie is configured, the cookie of that name containing a language code (e.g., de or de-CH).
    • Input context (i.e., HTTP headers of the client) for the attribute Accept-Language. Find the dictionary by matching the detected languages against the available languages (literalDictionaryLanguages=en,de,it,fr). If there is no match, the first language in the available list is used as default.
  • Translate each label attribute in the GUI descriptor by looking up the value in the dictionary. If the element represents an error message and there is no match, search for the label value with whitespaces replaced by underscores "_" or a label "error_X", where_X* is the error code. If there is no match, the current value remains.

This mechanism is used for simple setups where the login page renderer (e.g., the one built-in in nevisProxy) only performs a simple transformation (from XML to HTML). For more advanced setups, the nevisLogRend component should be used instead and the useLiteralDictionary should be set to false.

The translations are defined in the LitDict files in the conf directory of the nevisAuth instance: /var/opt/nevisauth/<instance>/conf/LitDict.properties.

info

Literal dictionary support is turned off per default (if not configured) and is enabled in the default configuration template, delivered with the package.

The translation literals may contain any code that the login renderer accepts. If Web pages are displayed with nevisLogRenderer, regular HTML tags can be inserted. Example:

Enter your <b>PIN number</b> and <br/> confirm that you have read and understood the disclaimer.

Parametrized translation texts

It is possible to construct complex translation texts using parametrized literals and annotated labels.

Given a configured literal

paramText=Mary had a little {1} whose {2} was {3} as {4}

the label

paramText[lamb][fleece][white][snow]

will translate to

Mary had a little lamb whose fleece was white as snow
info

This mechanism uses Java's MessageFormat class. Note that this class treats single quotes as special signs. To use single quotes in parametrized translation texts, you have to escape them with quotes. So " ' ' " will display as a single quote.

Translations using recursive variable resolution

It is also possible to construct complex translation texts by including variable expressions in the translation. Above example can also be written as

paramText=Mary had a little ${notes:animal} whose ${inargs:variableName} was ${notes:color} as ${...}.

This assumes that the variables notes:animal, inargs:variableName and notes:color are set at the time the translation text is resolved.