"subst" (string::subst)
Substitutes placeholders ($1 to $9) in a string with given arguments and returns the substituted string.
Synopsis
string.subst( string subsitution, ...);
Parameters
Parameter | Description |
---|---|
substitution | String the placeholder in the given string is replaced by, in order from $1 to $9 |
Description
This string member function will substitute the placeholders $1 to $9 with the strings given as arguments and return the substituted string.
Substituting placeholders in a translation with the tr() function:
DebugN(tr("The file $1 could not be read due to error $2").subst(fileName, eror));
With this, the constant string literal in the tr() function call can be extracted by projectTranslationUpdate() and during runtime the translated text will be shown with the $-Parameters replaced with given arguments.