Prev | Next | mainResponder Verbs > mainResponder.getString |
mainResponder.getString
Syntax |
mainResponder.getString (stringId, replacementTableAddress = nil, languageTableAddress = nil, pta = nil)
|
Params |
stringId is a dot-delimited string representing the path to traverse to find a translated string in the language table. replacementTableAddress is the optional address of a table, which contains name/value pairs used for replacing placeholders in the translated string, with calculated values. languageTableAddress is the optional address of a language table in which to look up a translated string. pta is the optional address of the page table.
|
Action |
Looks up a string in a translation table at languageTableAddress, based on it's path inside the table, as defined by stringId.
|
Returns |
The translated string.
|
Examples |
mainResponder.getString ("discuss.messageDeleted") » "This message has been deleted."
Given a table, replacemenTable, which contains a number named size, whose value is 427:
|
Notes |
This is mainResponder's wrapper for Frontier.getString. mainResponder.getString determines which language string to return, by looking at your site's language preference, defined by a string named language in your site's #prefs table. Unless you specify languageTableAddress, strings are looked up in mainresponder.localization.languages.[language].strings, where [lanugage] is your site's language preference. If you have not specified a language for a given site, mainResponder.getString will use the server's default language as defined in config.mainResponder.globals.language. If there is no global language setting, mainResponder.getString will return an English language string. If you pass in an address for replacementTableAddress, all sub-strings in the translated string which are delimited by double square-brackets will be replaced with strings in the replacement table. For example, given a translated string which contains [[msgnum]], and a replacement table which contains a string named msgnum, whose value is "2", all instances of [[msgnum]] in the translated string will be replaced with 2. Values in the replacement table may be any value which can be coerced to a string.
|
See also |
Frontier.getString
|
Prev | Next | mainResponder Verbs > mainResponder.getString |