Localized and Dynamic Strings

The tag library makes it easy to insert localized strings or dynamic variables.

Any variables included must be passed into the UI module using the $variables argument to the LiveContent-UI:get_html() function.

ResultDescriptionParameters

Localized String

<lcui:string/> or <xsl:call-template name="lcui:string"/>

Inserts a localized string by key name. Also passes back an attribute that includes the key to the parent element, to facilitate in-context language switching. A localized string should be the only child of its parent element (it should not have siblings). This tag or named template does not produce a tag, only text and an attribute node. If the localized string is not located, no text is output, but the attribute node is still created.

  • key: Key of the localized string to fetch (for example, admin.title)

Dynamic Variable

<lcui:var/> or <xsl:call-template name="lcui:var/>

Inserts the string value of a dynamic variable that was passed in via XQuery. Also passes back an attribute that includes the variable name to the parent element. This tag or named template does not produce a tag, only text and an attribute node. If the variable is not located, no text is output, but the attribute node is still created.

  • key: Name of the dynamic variable to pull (for example, app.version).

This is a snippet from the semi-static Admin Status HTML template. The admin.xql module loads this HTML template when admin.xql?action=status is invoked.

The admin.xql module creates a set of dynamic variables and passes them to the LiveContent-UI:get_html(..) function , which processes the HTML template and inserts them.

<tr>
     <th>
     <!-- This call to lcui:string inserts a localized string (in English, Application Version). -->
     <lcui:string key="app.version"/>
     </th>
     <td>
     <!-- This call to lcui:var inserts a dynamic variable that the admin.xql module passed in, with the name of app.version (for example, it might be 5.0.1) -->
     <lcui:var key="app.version"/>
     </td>
</tr>