Skip to content

[Translation] Improve the grammar in the example messages #16943

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
Jul 8, 2022
Merged
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
26 changes: 18 additions & 8 deletions translation/message_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ typical usage of this is gender:
{organizer_gender, select,
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!}
multi {{organizer_name} have invited you to their party!}
other {{organizer_name} has invited you to their party!}
}

.. code-block:: xml
Expand All @@ -118,7 +119,8 @@ typical usage of this is gender:
<target>{organizer_gender, select,
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!}
multi {{organizer_name} have invited you to their party!}
other {{organizer_name} has invited you to their party!}
}</target>
</trans-unit>
</body>
Expand All @@ -133,7 +135,8 @@ typical usage of this is gender:
'invitation_title' => '{organizer_gender, select,
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!}
multi {{organizer_name} have invited you to their party!}
other {{organizer_name} has invited you to their party!}
}',
];

Expand All @@ -152,6 +155,12 @@ select. This function is applied over the ``organizer_gender`` variable::
// prints "John & Jane have invited you to their party!"
echo $translator->trans('invitation_title', [
'organizer_name' => 'John & Jane',
'organizer_gender' => 'multi',
]);

// prints "McDonalds has invited you to their party!"
echo $translator->trans('invitation_title', [
'organizer_name' => 'McDonalds',
'organizer_gender' => 'not_applicable',
]);

Expand All @@ -170,7 +179,7 @@ you to use literal text in the select statements:
While it might seem more logical to only put ``her``, ``his`` or ``their``
in the switch statement, it is better to use "complex arguments" at the
outermost structure of the message. The strings are in this way better
readable for translators and, as you can see in the ``other`` case, other
readable for translators and, as you can see in the ``multi`` case, other
parts of the sentence might be influenced by the variables.

.. tip::
Expand All @@ -179,12 +188,13 @@ you to use literal text in the select statements:
without having to define them in any file::

$invitation = '{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!}
multi {{organizer_name} have invited you to their party!}
other {{organizer_name} has invited you to their party!}
}';

// prints "Ryan has invited you for his party!"
// prints "Ryan has invited you to his party!"
echo $translator->trans($invitation, [
'organizer_name' => 'Ryan',
'organizer_gender' => 'male',
Expand Down