Page tree
Skip to end of metadata
Go to start of metadata

pui.getLanguageText( dictionary, messageID, [variableValues] )

This JavaScript function can be used to retrieve a phrase from a dictionary in the language that the user has configured and returns it. For information on how to define a dictionary see Language Support

Required parameters:

  • dictionary - a dictionary to lookup phrases, for example "runtimeMsg". 
  • messageID - an identifier for a specific message within a dictionary. 

Optional Parameter:

  • variableValues - an array of values to be placed in a variable called "&1", "&2", "&3", etc. 

For example, if you have a dictionary defined as follows (for more information about dictionaries see Language Support). 

pui["AcmeSignOn"]["en_US"]["OkButton"] = "Okay";
pui["AcmeSignOn"]["en_US"]["CancelButton"] = "Cancel";
pui["AcmeFileApp"]["en_US"]["File Missing"] = "File &1 not found in the &2 folder.";

Then you can retrieve messages like the example below.

var myOkText = pui.getLanguageText("AcmeSignOn", "OkButton");
applyProperty("MyButton", "value", myOkText);
applyProperty("Button2", "value", pui.getLanguageText("AcmeSignOn", "CancelButton"));

The following example shows replacing variables "&1" and "&2" with a fileName and a folderName.

var fileName = "example.json";
var folderName = "/home/jerry";
var errorMessage = pui.getLanguageText("AcmeFileApp", "File Missing", [fileName, folderName]);
pui.errorTip("MyTextbox", errorMessage);
  • No labels