Skip to content

Correct spelling & grammar in 4.4 translation/ #16288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion translation/locale.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ it::
The custom listener must be called **before** ``LocaleListener``, which
initializes the locale based on the current request. To do so, set your
listener priority to a higher value than ``LocaleListener`` priority (which
you can obtain running the ``debug:event kernel.request`` command).
you can obtain by running the ``debug:event kernel.request`` command).

Read :doc:`/session/locale_sticky_session` for more information on making
the user's locale "sticky" to their session.
Expand Down
34 changes: 17 additions & 17 deletions translation/message_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ How to Translate Messages using the ICU MessageFormat
Support for ICU MessageFormat was introduced in Symfony 4.2.

Messages (i.e. strings) in applications are almost never completely static.
They contain variables or other complex logic like pluralization. In order to
They contain variables or other complex logic like pluralization. To
handle this, the Translator component supports the `ICU MessageFormat`_ syntax.

.. tip::
Expand Down Expand Up @@ -92,7 +92,7 @@ Selecting Different Messages Based on a Condition

The curly brace syntax allows to "modify" the output of the variable. One of
these functions is the ``select`` function. It acts like PHP's `switch statement`_
and allows to use different strings based on the value of the variable. A
and allows you to use different strings based on the value of the variable. A
typical usage of this is gender:

.. configuration-block::
Expand All @@ -104,9 +104,9 @@ typical usage of this is gender:
# the 'other' key is required, and is selected if no other case matches
invitation_title: >-
{organizer_gender, select,
female {{organizer_name} has invited you for her party!}
male {{organizer_name} has invited you for his party!}
other {{organizer_name} have invited you for their party!}
female {{organizer_name} has invited you to her party!}
male {{organizer_name} has invited you to his party!}
other {{organizer_name} have invited you to their party!}
}

.. code-block:: xml
Expand All @@ -120,9 +120,9 @@ typical usage of this is gender:
<source>invitation_title</source>
<!-- the 'other' key is required, and is selected if no other case matches -->
<target>{organizer_gender, select,
female {{organizer_name} has invited you for her party!}
male {{organizer_name} has invited you for his party!}
other {{organizer_name} have invited you for their party!}
female {{organizer_name} has invited you to her party!}
male {{organizer_name} has invited you to his party!}
other {{organizer_name} have invited you to their party!}
}</target>
</trans-unit>
</body>
Expand All @@ -135,9 +135,9 @@ typical usage of this is gender:
return [
// the 'other' key is required, and is selected if no other case matches
'invitation_title' => '{organizer_gender, select,
female {{organizer_name} has invited you for her party!}
male {{organizer_name} has invited you for his party!}
other {{organizer_name} have invited you for their party!}
female {{organizer_name} has invited you to her party!}
male {{organizer_name} has invited you to his party!}
other {{organizer_name} have invited you to their party!}
}',
];

Expand All @@ -147,13 +147,13 @@ later, ``function_statement`` is optional for some functions). In this case,
the function name is ``select`` and its statement contains the "cases" of this
select. This function is applied over the ``organizer_gender`` variable::

// prints "Ryan has invited you for his party!"
// prints "Ryan has invited you to his party!"
echo $translator->trans('invitation_title', [
'organizer_name' => 'Ryan',
'organizer_gender' => 'male',
]);

// prints "John & Jane have invited you for their party!"
// prints "John & Jane have invited you to their party!"
echo $translator->trans('invitation_title', [
'organizer_name' => 'John & Jane',
'organizer_gender' => 'not_applicable',
Expand All @@ -164,10 +164,10 @@ you to use literal text in the select statements:

#. The first ``{organizer_gender, select, ...}`` block starts the "code" mode,
which means ``organizer_gender`` is processed as a variable.
#. The inner ``{... has invited you for her party!}`` block brings you back in
#. The inner ``{... has invited you to her party!}`` block brings you back in
"literal" mode, meaning the text is not processed.
#. Inside this block, ``{organizer_name}`` starts "code" mode again, allowing
``organizer_name`` to be processed as variable.
``organizer_name`` to be processed as a variable.

.. tip::

Expand Down Expand Up @@ -225,7 +225,7 @@ handle pluralization in your messages (e.g. ``There are 3 apples`` vs
Pluralization rules are actually quite complex and differ for each language.
For instance, Russian uses different plural forms for numbers ending with 1;
numbers ending with 2, 3 or 4; numbers ending with 5, 6, 7, 8 or 9; and even
some exceptions of this!
some exceptions to this!

In order to properly translate this, the possible cases in the ``plural``
function are also different for each language. For instance, Russian has
Expand Down Expand Up @@ -279,7 +279,7 @@ Usage of this string is the same as with variables and select::
.. sidebar:: Using Ranges in Messages

The pluralization in the legacy Symfony syntax could be used with custom
ranges (e.g. have a different messages for 0-12, 12-40 and 40+). The ICU
ranges (e.g. have different messages for 0-12, 12-40 and 40+). The ICU
message format does not have this feature. Instead, this logic should be
moved to PHP code::

Expand Down