Skip to content

[Form] Documented the choice_self_translation option of LanguageType #12750

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 4, 2019
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
18 changes: 18 additions & 0 deletions reference/forms/types/language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ manually, but then you should just use the ``ChoiceType`` directly.
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
+-------------+------------------------------------------------------------------------+
| Options | - `alpha3`_ |
| | - `choice_self_translation`_ |
| | - `choice_translation_locale`_ |
+-------------+------------------------------------------------------------------------+
| Overridden | - `choices`_ |
Expand Down Expand Up @@ -74,6 +75,23 @@ If this option is ``true``, the choice values use the `ISO 639-2 alpha-3`_
three-letter codes (e.g. French = ``fra``) instead of the default
`ISO 639-1 alpha-2`_ two-letter codes (e.g. French = ``fr``).

choice_self_translation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By only looking at the option name I would not really know what this is supposed to do. Can we think of something more self-explanatory?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you. I've updated the description. Is it more clear now? Thanks.

Copy link
Member

@xabbuh xabbuh Dec 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was rather thinking about renaming the option. But sadly I cannot come up with a better name. 😞

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we can discuss that separately.

~~~~~~~~~~~~~~~~~~~~~~~

**type**: ``boolean`` **default**: ``false``

.. versionadded:: 5.1

The ``choice_self_translation`` option was introduced in Symfony 5.1.

By default, the choice values are translated into the locale of the application.
For example, when using ``en`` as the locale, you'll get an array like
``[..., 'cs' => 'Czech', ..., 'es' => 'Spanish', ..., 'zh' => 'Chinese']``.

If this option is ``true``, each choice value is translated into its own
language. The resulting array is the same regardless of the application locale:
``[..., 'cs' => 'čeština', ..., 'es' => 'español', ..., 'zh' => '中文']``.

.. include:: /reference/forms/types/options/choice_translation_locale.rst.inc

Overridden Options
Expand Down