This is a test site. Any changes will be lost!

Using variables in localization strings: Difference between revisions

From MoodleDocs
New page: Language strings are defined as follows: <pre>$string['stringname'] = 'This is a string';</pre> and are called via: <pre>get_string("stringname","wherefrom")</pre> If you wish to use a...
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 14: Line 14:


<pre>$string['stringname'] = 'This is a string with a variable called $a';</pre>
<pre>$string['stringname'] = 'This is a string with a variable called $a';</pre>
[[Category:Developer|Localization strings and variables]]
[[Category:Language]]

Latest revision as of 10:37, 14 July 2008

Language strings are defined as follows:

$string['stringname'] = 'This is a string';

and are called via:

get_string("stringname","wherefrom")

If you wish to use a variable from the calling page in the string then you will need to use the following variation to call it:

get_string("stringname","wherefrom","passedvariable")

The variable can then be used in your string as follows:

$string['stringname'] = 'This is a string with a variable called $a';