|
|
Line 1: |
Line 1: |
| Language strings are defined as follows:
| | {{Moved_to_dev_docs}} |
| | |
| <pre>$string['stringname'] = 'This is a string';</pre>
| |
| | |
| and are called via:
| |
| | |
| <pre>get_string("stringname","wherefrom")</pre>
| |
| | |
| 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:
| |
| | |
| <pre>get_string("stringname","wherefrom","passedvariable")</pre>
| |
| | |
| The variable can then be used in your string as follows:
| |
| | |
| <pre>$string['stringname'] = 'This is a string with a variable called {$a}';</pre>
| |
| | |
| Note that in Moodle 1.9, the { } are optional. From Moodle 2.0 onwards, they are required, so you should get into the habit of using them now.
| |
| | |
| | |
| [[Category:Developer|Localization strings and variables]]
| |
| [[Category:Language]]
| |
Latest revision as of 08:46, 22 June 2011