8000 some tweaks for #3190 · cordoval/symfony-docs@0c1c2ce · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c1c2ce

Browse files
xabbuhweaverryan
authored andcommitted
some tweaks for symfony#3190
1 parent 2e649b3 commit 0c1c2ce

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

book/translation.rst

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ to learn even more. Overall, the process has several steps:
4141
for each supported locale that translate each message in the application;
4242

4343
#. Determine, :ref:`set and manage the user's locale <book-translation-user-locale>`
44-
for the request and optionally on the user's entire session.
44+
for the request and optionally
45+
:doc:`on the user's entire session </cookbook/session/locale_sticky_session>`.
4546

4647
.. _book-translation-configuration:
4748

@@ -147,11 +148,12 @@ different formats, XLIFF being the recommended format:
147148
# messages.fr.yml
148149
Symfony2 is great: J'aime Symfony2
149150
150-
For information on where these files should be located, see :ref:`book-translation-resource-locations`.
151+
For information on where these files should be located, see
152+
:ref:`book-translation-resource-locations`.
151153

152154
Now, if the language of the user's locale is French (e.g. ``fr_FR`` or ``fr_BE``),
153155
the message will be translated into ``J'aime Symfony2``. You can also translate
154-
message inside your :ref:`templates <book-translation-tags>`.
156+
the message inside your :ref:`templates <book-translation-tags>`.
155157

156158
The Translation Process
157159
~~~~~~~~~~~~~~~~~~~~~~~
@@ -278,8 +280,8 @@ texts* and complex expressions:
278280
Using the translation tags or filters have the same effect, but with
279281
one subtle difference: automatic output escaping is only applied to
280282
translations using a filter. In other words, if you need to be sure
281-
that your translated is *not* output escaped, you must apply the
282-
``raw`` filter after the translation filter:
283+
that your translated message is *not* output escaped, you must apply
284+
the ``raw`` filter after the translation filter:
283285

284286
.. code-block:: jinja
285287
@@ -290,7 +292,7 @@ texts* and complex expressions:
290292
291293
{% set message = '<h3>foo</h3>' %}
292294
293-
{# strings and variables translated via a filter is escaped by default #}
295+
{# strings and variables translated via a filter are escaped by default #}
294296
{{ message|trans|raw }}
295297
{{ '<h3>bar</h3>'|trans|raw }}
296298
@@ -303,7 +305,7 @@ texts* and complex expressions:
303305
{% trans_default_domain "app" %}
304306
305307
Note that this only influences the current template, not any "included"
306-
templates (in order to avoid side effects).
308+
template (in order to avoid side effects).
307309

308310
.. versionadded:: 2.1
309311
The ``trans_default_domain`` tag is new in Symfony 2.1
@@ -349,7 +351,7 @@ The filename of the translation files is also important: each message file
349351
must be named according to the following path: ``domain.locale.loader``:
350352

351353
* **domain**: An optional way to organize messages into groups (e.g. ``admin``,
352-
``navigation`` or the default ``messages``) - see ":ref:`using-message-domains`";
354+
``navigation`` or the default ``messages``) - see :ref:`using-message-domains`;
353355

354356
* **locale**: The locale that the translations are for (e.g. ``en_GB``, ``en``, etc);
355357

@@ -377,7 +379,7 @@ taste. For more options, see :ref:`component-translator-message-catalogs`.
377379

378380
Each time you create a *new* translation resource (or install a bundle
379381
that includes a translation resource), be sure to clear your cache so
380-
that Symfony can discover the new translation resource:
382+
that Symfony can discover the new translation resources:
381383

382384
.. code-block:: bash
383385
@@ -484,11 +486,13 @@ by the routing system using the special ``_locale`` parameter:
484486
return $collection;
485487
486488
When using the special ``_locale`` parameter in a route, the matched locale
487-
will *automatically be set on the user's session*. In other words, if a user
489+
will *automatically be set on the Request* and can be retrieved via the
490+
:method:`Symfony\\Component\\HttpFoundation\\Request::getLocale` method.
491+
In other words, if a user
488492
visits the URI ``/fr/contact``, the locale ``fr`` will automatically be set
489-
as the locale for the user's session.
493+
as the locale for the current request.
490494

491-
You can now use the user's locale to create routes to other translated pages
495+
You can now use the locale to create routes to other translated pages
492496
in your application.
493497

494498
Setting a Default Locale
@@ -659,7 +663,7 @@ steps:
659663
* Abstract messages in your application by wrapping each in either the
660664
:method:`Symfony\\Component\\Translation\\Translator::trans` or
661665
:method:`Symfony\\Component\\Translation\\Translator::transChoice` methods
662-
(learn about this in ":doc:`/components/translation/usage`");
666+
(learn about this in :doc:`/components/translation/usage`);
663667

664668
* Translate each message into multiple locales by creating translation message
665669
files. Symfony2 discovers and processes each file because its name follows

components/translation/introduction.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Installation
1313

1414
You can install the component in 2 different ways:
1515

16-
* :doc:`Install it via Composer</components/using_components>` (``symfony/translation`` on `Packagist`_).
17-
* Use the official Git repository (https://github.com/symfony/Translation);
16+
* :doc:`Install it via Composer </components/using_components>` (``symfony/translation`` on `Packagist`_);
17+
* Use the official Git repository (https://github.com/symfony/Translation).
1818

1919
Constructing the Translator
2020
---------------------------
2121

22-
The main access point of the Translation Component is
22+
The main access point of the Translation component is
2323
:class:`Symfony\\Component\\Translation\\Translator`. Before you can use it,
2424
you need to configure it and load the messages to translate (called *message
2525
catalogs*).
@@ -59,7 +59,7 @@ class. A message catalog is like a dictionary of translations for a specific
5959
locale.
6060

6161
The Translation component uses Loader classes to load catalogs. You can load
62-
multiple resources for the same locale, it will be combined into one
62+
multiple resources for the same locale, which will then be combined into one
6363
catalog.
6464

6565
The component comes with some default Loaders and you can create your own
@@ -90,10 +90,10 @@ Loader too. The default loaders are:
9090

9191
.. versionadded:: 2.1
9292
The ``IcuDatFileLoader``, ``IcuResFileLoader``, ``IniFileLoader``,
93-
``MofileLoader``, ``PoFileLoader`` and ``QtFileLoader`` are new in
93+
``MofileLoader``, ``PoFileLoader`` and ``QtFileLoader`` were added in
9494
Symfony 2.1
9595

96-
All file loaders require the :doc:`Config component</components/config/index>`.
96+
All file loaders require the :doc:`Config component </components/config/index>`.
9797

9898
At first, you should add one or more loaders to the ``Translator``::
9999

@@ -203,7 +203,7 @@ specified locale.
203203
Usage
204204
-----
205205

206-
Read how to use the Translation component in ":doc:`/components/translation/usage`".
206+
Read how to use the Translation component in :doc:`/components/translation/usage`.
207207

208208
.. _Packagist: https://packagist.org/packages/symfony/translation
209209
.. _`ISO3166 Alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes

components/translation/usage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Imagine you want to translate the string *"Symfony2 is great"* into French::
1414
$translator->addResource('array', array(
1515
'Symfony2 is great!' => 'J\'aime Symfony2!',
1616
), 'fr_FR');
17-
17+
1818
echo $translator->trans('Symfony2 is great!');
1919

2020
In this example, the message *"Symfony2 is great!"* will be translated into
@@ -81,7 +81,7 @@ is done just as before:
8181

8282
The placeholders can take on any form as the full message is reconstructed
8383
using the PHP :phpfunction:`strtr function<strtr>`. But the ``%...%`` form
84-
is recommend, to avoid problems when using Twig.
84+
is recommended, to avoid problems when using Twig.
8585

8686
As you've seen, creating a translation is a two-step process:
8787

@@ -257,7 +257,7 @@ To translate pluralized messages, use the
257257
array('%count%' => 10)
258258
);
259259

260-
The second argument (``10`` in this example), is the *number* of objects being
260+
The second argument (``10`` in this example) is the *number* of objects being
261261
described and is used to determine which translation to use and also to populate
262262
the ``%count%`` placeholder.
263263

0 commit comments

Comments
 (0)
0