OpenWGA 7.0 - TMLScript reference

TMLContext "this"
Method :

label([[container, ] file, ] key [, params])
label(database, container, file, key , params [, returnPlaceholder])

On object TMLContext "this"
Usage Returns a WebTML label in a language that the user should understand
Description Labels are text fragments with unique keys, carrying some single information for usage in the websites design. A label of a given key may be available in multiple languages, making it able to provide it in different languages for different users, effectively allowing multi-language designs.

This method is the TMLScript pendant of WebTML tag <tml:label>. For further information about labels see there.

There are two variants of the label method. A simpler variant 1, which will always use the current design database and a variant 2 which will let you choose the database.

For using label functionality inside custom TMLScript objects see function localLabel() which is able to find the correct design context of your object.

When used in non-web environment the label method returns labels in the language of the main context.
Parameters database (WGAPI object WGDatabase):
Variant 2: Design database from which to load labels.

container (String, optional in variant 1):
File container basename (without language suffix) holding label files. When omitted uses the currently active default container basename, "labels" if not determined.

file (String, optional in variant 1):
Label file holding label definitions. When omitted uses the current active default filename, "general" if not determined.

key (String):
The key of the label

params (List of strings, optional in variant 1):
Values that should be used as label parameters. The string at list position 0 is used as parameter 1, position 1 as parameter 2 and so on. Specify null as list element for parameters that should be cleared.

returnPlaceholder (Boolean, optional):
Variant 2: Controls if a label placeholder is to be returned if the label was not found in any possible language, defaults to true. The placeholder identifies container, file and key of the label that was not found. If this is set to false null is returned instead.
Return value Textlabel (String)
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events