You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See the :ref:`dic-tags-translation-loader` tag for more information.
183
201
184
-
.. tip::
202
+
.. caution::
185
203
186
204
Each time you create a *new* translation resource (or install a bundle
187
205
that includes a translation resource), be sure to clear your cache so
@@ -191,9 +209,6 @@ taste.
191
209
192
210
$ php app/console cache:clear
193
211
194
-
.. index::
195
-
single: Translations; User's locale
196
-
197
212
Handling the User's Locale
198
213
--------------------------
199
214
@@ -282,9 +297,6 @@ as the locale for the user's session.
282
297
You can now use the user's locale to create routes to other translated pages
283
298
in your application.
284
299
285
-
.. index::
286
-
single: Translations; In templates
287
-
288
300
Translations in Templates
289
301
-------------------------
290
302
@@ -296,11 +308,6 @@ support for both Twig and PHP templates.
296
308
Twig Templates
297
309
~~~~~~~~~~~~~~
298
310
299
-
..
300
-
However, the ``%var%``
301
-
notation is required when translating in Twig templates, and is overall a
302
-
sensible convention to follow.
303
-
304
311
Symfony2 provides specialized Twig tags (``trans`` and ``transchoice``) to
305
312
help with message translation of *static blocks of text*:
306
313
@@ -316,6 +323,11 @@ The ``transchoice`` tag automatically gets the ``%count%`` variable from
316
323
the current context and passes it to the translator. This mechanism only
317
324
works when you use a placeholder following the ``%var%`` pattern.
318
325
326
+
.. caution::
327
+
328
+
The ``%var%`` notation of placeholders is required when translating in
329
+
Twig templates.
330
+
319
331
.. tip::
320
332
321
333
If you need to use the percent character (``%``) in a string, escape it by
@@ -480,7 +492,9 @@ empty, add the following:
480
492
}
481
493
}
482
494
483
-
Create a translation file under the ``validators`` catalog for the constraint messages, typically in the ``Resources/translations/`` directory of the bundle. See `Message Catalogues`_ for more details.
495
+
Create a translation file under the ``validators`` catalog for the constraint
496
+
messages, typically in the ``Resources/translations/`` directory of the
0 commit comments