<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/index.php?action=history&amp;feed=atom&amp;title=Using_variables_in_localization_strings</id>
	<title>Using variables in localization strings - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/index.php?action=history&amp;feed=atom&amp;title=Using_variables_in_localization_strings"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Using_variables_in_localization_strings&amp;action=history"/>
	<updated>2026-06-11T22:06:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Using_variables_in_localization_strings&amp;diff=26462&amp;oldid=prev</id>
		<title>Deraadt: Created page with &quot;Language strings are defined as follows:  &lt;pre&gt;$string[&#039;stringname&#039;] = &#039;This is a string&#039;;&lt;/pre&gt;  and are called via:  &lt;pre&gt;get_string(&quot;stringname&quot;,&quot;wherefrom&quot;)&lt;/pre&gt;  If you wis...&quot;</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Using_variables_in_localization_strings&amp;diff=26462&amp;oldid=prev"/>
		<updated>2011-06-22T08:45:54Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Language strings are defined as follows:  &amp;lt;pre&amp;gt;$string[&amp;#039;stringname&amp;#039;] = &amp;#039;This is a string&amp;#039;;&amp;lt;/pre&amp;gt;  and are called via:  &amp;lt;pre&amp;gt;get_string(&amp;quot;stringname&amp;quot;,&amp;quot;wherefrom&amp;quot;)&amp;lt;/pre&amp;gt;  If you wis...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Language strings are defined as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$string[&amp;#039;stringname&amp;#039;] = &amp;#039;This is a string&amp;#039;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and are called via:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;get_string(&amp;quot;stringname&amp;quot;,&amp;quot;wherefrom&amp;quot;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;get_string(&amp;quot;stringname&amp;quot;,&amp;quot;wherefrom&amp;quot;,&amp;quot;passedvariable&amp;quot;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable can then be used in your string as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$string[&amp;#039;stringname&amp;#039;] = &amp;#039;This is a string with a variable called {$a}&amp;#039;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;/div&gt;</summary>
		<author><name>Deraadt</name></author>
	</entry>
</feed>