0 Votes

Language-dependent text items

Last modified by WikiBot on 2025/03/20 14:15

Language-dependent text items

The text items in forms (e.g., labels, help strings) may be language-dependent.

A language-dependent text item is represented as a list (lang "text" lang "text" … [:dict entry] [:alt "text"]).

The dictionary entry is either (1) a list (key1 …) that describes a topic in the dictionary or (2) a symbol, which is treated as a list (*labels* entry), or (3) a list (&APP application_name type_name component_name ... key) interpreted as translation of an attribute of a named data object.

The translation is searched in the following order:

  • The text in the current language, if present;
  • The text from the dictionary if :dict entry is present. If the entry is not found in the dictionary, the text from :alt option is used, if supplied. Otherwise "entry" is returned;
  • The first text in a supported language;
  • The text given in :alt option
  • The first text.

A text reference (:dict (key1 …)) may also be written as (& key1 …).

When the user edits a language-dependent text, only the translation in the current language is changed (or added if it was missing). The dictionary is not changed.

A text reference (:eval expr) is evaluated as a script expression (in the environment of the data object the text is associated with). If the result is not a string, it is again interpreted as a language-dependent text.