translateToken
From AgileApps Support Wiki
The translateToken API accesses a Custom Label (a message) defined in the Translation Workbench.
- Syntax
- <syntaxhighlight lang="java" enclose="div">
String result = Functions.translateToken(String key) String result = Functions.translateToken(String key, String [] args) </syntaxhighlight>
- Parameters
-
- key
- The category and token (index key) for the message to retrieve, in the form: "#category.token_name".
- args
- An array of string-arguments to be substituted into the message, in the locations defined by the message format.
- Returns
- A string containing the selected message in the user's currently active language, with specified arguments substituted.
- Example
- In this example, go_msg is a Custom Label in the Translation Workbench created in the "custom" category, where the translation in the user's current language is "It's a {1} day for a {2}." Supplying the arguments then allows for variations on the message.
- <syntaxhighlight lang="java" enclose="div">
String [] args = {"nice", "walk"}; String msg = Functions.translateToken("#custom.go_msg", args));
// ==> "It's a nice day for a walk."
</syntaxhighlight>