Skip to content

Use xliff (xml) as first option in the configuration-block #11671

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

Closed
Closed
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
106 changes: 53 additions & 53 deletions translation/message_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ In order to use the ICU Message Format, the :ref:`message domain
====================== ===============================
Normal file name ICU Message Format filename
====================== ===============================
``messages.en.yml`` ``messages+intl-icu.en.yml``
``messages.en.yaml`` ``messages+intl-icu.en.yaml``
``messages.fr_FR.xlf`` ``messages+intl-icu.fr_FR.xlf``
``admin.en.yml`` ``admin+intl-icu.en.yml``
``admin.en.yaml`` ``admin+intl-icu.en.yaml``
====================== ===============================

All messages in this file will now be processed by the
Expand All @@ -43,11 +43,6 @@ The basic usage of the MessageFormat allows you to use placeholders (called

.. configuration-block::

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
say_hello: 'Hello {name}!'

.. code-block:: xml

<!-- translations/messages+intl-icu.en.xlf -->
Expand All @@ -63,6 +58,11 @@ The basic usage of the MessageFormat allows you to use placeholders (called
</file>
</xliff>

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
say_hello: 'Hello {name}!'

.. code-block:: php

// translations/messages+intl-icu.en.php
Expand All @@ -89,16 +89,6 @@ typical usage of this is gender:

.. configuration-block::

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
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!}
}

.. code-block:: xml

<!-- translations/messages+intl-icu.en.xlf -->
Expand All @@ -114,6 +104,16 @@ typical usage of this is gender:
</file>
</xliff>

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
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!}
}

.. code-block:: php

// translations/messages+intl-icu.en.php
Expand Down Expand Up @@ -170,16 +170,6 @@ handle pluralization in your messages (e.g. ``There are 3 apples`` vs

.. configuration-block::

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
num_of_apples: >
{apples, plural,
=0 {There are no apples}
one {There is one apple...}
other {There are # apples!}
}

.. code-block:: xml

<!-- translations/messages+intl-icu.en.xlf -->
Expand All @@ -195,6 +185,16 @@ handle pluralization in your messages (e.g. ``There are 3 apples`` vs
</file>
</xliff>

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
num_of_apples: >
{apples, plural,
=0 {There are no apples}
one {There is one apple...}
other {There are # apples!}
}

.. code-block:: php

// translations/messages+intl-icu.en.php
Expand Down Expand Up @@ -275,21 +275,6 @@ Similar to ``plural``, ``selectordinal`` allows you to use numbers as ordinal sc

.. configuration-block::

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
finish_place: >
You finished {place, selectordinal,
one {#st}
two {#nd}
few {#rd}
other {#th}
}!

# when only formatting the number as ordinal (like above), you can also
# use the `ordinal` function:
finish_place: You finished {place, ordinal}!

.. code-block:: xml

<!-- translations/messages+intl-icu.en.xlf -->
Expand All @@ -312,6 +297,21 @@ Similar to ``plural``, ``selectordinal`` allows you to use numbers as ordinal sc
</file>
</xliff>

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
finish_place: >
You finished {place, selectordinal,
one {#st}
two {#nd}
few {#rd}
other {#th}
}!

# when only formatting the number as ordinal (like above), you can also
# use the `ordinal` function:
finish_place: You finished {place, ordinal}!

.. code-block:: php

// translations/messages+intl-icu.en.php
Expand Down Expand Up @@ -349,11 +349,6 @@ using the :phpclass:`IntlDateFormatter`:

.. configuration-block::

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
published_at: 'Published at {publication_date, date} - {publication_date, time, short}'

.. code-block:: xml

<!-- translations/messages+intl-icu.en.xlf -->
Expand All @@ -369,6 +364,11 @@ using the :phpclass:`IntlDateFormatter`:
</file>
</xliff>

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
published_at: 'Published at {publication_date, date} - {publication_date, time, short}'

.. code-block:: php

// translations/messages+intl-icu.en.php
Expand All @@ -391,12 +391,6 @@ The ``number`` formatter allows you to format numbers using Intl's :phpclass:`Nu

.. configuration-block::

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
progress: '{progress, number, percent} of the work is done'
value_of_object: 'This artifact is worth {value, number, currency}'

.. code-block:: xml

<!-- translations/messages+intl-icu.en.xlf -->
Expand All @@ -417,6 +411,12 @@ The ``number`` formatter allows you to format numbers using Intl's :phpclass:`Nu
</file>
</xliff>

.. code-block:: yaml

# translations/messages+intl-icu.en.yaml
progress: '{progress, number, percent} of the work is done'
value_of_object: 'This artifact is worth {value, number, currency}'

.. code-block:: php

// translations/messages+intl-icu.en.php
Expand Down