@@ -100,9 +100,9 @@ for example, that you're translating a simple message from inside a controller::
100
100
101
101
public function indexAction()
102
102
{
103
- $t = $this->get('translator')->trans('Symfony2 is great');
103
+ $translated = $this->get('translator')->trans('Symfony2 is great');
104
104
105
- return new Response($t );
105
+ return new Response($translated );
106
106
}
107
107
108
108
When this code is executed, Symfony2 will attempt to translate the message
@@ -176,9 +176,9 @@ Sometimes, a message containing a variable needs to be translated::
176
176
177
177
public function indexAction($name)
178
178
{
179
- $t = $this->get('translator')->trans('Hello '.$name);
179
+ $translated = $this->get('translator')->trans('Hello '.$name);
180
180
181
- return new Response($t );
181
+ return new Response($translated );
182
182
}
183
183
184
184
However, creating a translation for this string is impossible since the translator
@@ -192,12 +192,12 @@ variable with a "placeholder"::
192
192
193
193
public function indexAction($name)
194
194
{
195
- $t = $this->get('translator')->trans(
195
+ $translated = $this->get('translator')->trans(
196
196
'Hello %name%',
197
197
array('%name%' => $name)
198
198
);
199
199
200
- return new Response($t );
200
+ return new Response($translated );
201
201
}
202
202
203
203
Symfony2 will now look for a translation of the raw message (``Hello %name% ``)
@@ -380,9 +380,9 @@ Symfony2 will discover these files and use them when translating either
380
380
This example illustrates the two different philosophies when creating
381
381
messages to be translated::
382
382
383
- $t = $translator->trans('Symfony2 is great');
383
+ $translated = $translator->trans('Symfony2 is great');
384
384
385
- $t = $translator->trans('symfony2.great');
385
+ $translated = $translator->trans('symfony2.great');
386
386
387
387
In the first method, messages are written in the language of the default
388
388
locale (English in this case). That message is then used as the "id"
@@ -619,7 +619,7 @@ all the forms as a string separated by a pipe (``|``)::
619
619
To translate pluralized messages, use the
620
620
:method: `Symfony\\ Component\\ Translation\\ Translator::transChoice ` method::
621
621
622
- $t = $this->get('translator')->transChoice(
622
+ $translated = $this->get('translator')->transChoice(
623
623
'There is one apple|There are %count% apples',
624
624
10,
625
625
array('%count%' => 10)
@@ -767,7 +767,7 @@ texts* and complex expressions:
767
767
Using the translation tags or filters have the same effect, but with
768
768
one subtle difference: automatic output escaping is only applied to
769
769
translations using a filter. In other words, if you need to be sure
770
- that your translated is *not * output escaped, you must apply the
770
+ that your translated is *not * output escaped, you must apply the
771
771
``raw `` filter after the translation filter:
772
772
773
773
.. code-block :: jinja
0 commit comments