Localizable Strings with Embedded Values
Some display strings have values embedded in them. You can use the errMsg()
function to display these strings. You can find the errMsg()
function, which is similar to the printf()
function in C, in the string.js file in the Configuration/Shared/MM/Scripts/CMN folder. Use the placeholder characters percent sign (%)
and s
to indicate where values should appear in the string and then pass the string and variable names as arguments to errMsg()
. For example:
<string id="featureX/fileNotFoundInFolder" value="File %s could not be found in folder %s."/>
The following example shows how the string, along with any variables to embed, is passed to the alert()
function.
if (fileMissing) { alert( errMsg(dw.loadString("featureX/fileNotFoundInFolder"),fileName,
folderName) );}