Skip to content

Commit 4653d76

Browse files
committed
minor #12750 [Form] Documented the choice_self_translation option of LanguageType (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #12750). Discussion ---------- [Form] Documented the choice_self_translation option of LanguageType Fixes #12745. Commits ------- 7361fdb [Form] Documented the choice_self_translation option of LanguageType
2 parents c1e6aa5 + 7361fdb commit 4653d76

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

reference/forms/types/language.rst

+18
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ manually, but then you should just use the ``ChoiceType`` directly.
2424
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
2525
+-------------+------------------------------------------------------------------------+
2626
| Options | - `alpha3`_ |
27+
| | - `choice_self_translation`_ |
2728
| | - `choice_translation_locale`_ |
2829
+-------------+------------------------------------------------------------------------+
2930
| Overridden | - `choices`_ |
@@ -74,6 +75,23 @@ If this option is ``true``, the choice values use the `ISO 639-2 alpha-3`_
7475
three-letter codes (e.g. French = ``fra``) instead of the default
7576
`ISO 639-1 alpha-2`_ two-letter codes (e.g. French = ``fr``).
7677

78+
choice_self_translation
79+
~~~~~~~~~~~~~~~~~~~~~~~
80+
81+
**type**: ``boolean`` **default**: ``false``
82+
83+
.. versionadded:: 5.1
84+
85+
The ``choice_self_translation`` option was introduced in Symfony 5.1.
86+
87+
By default, the choice values are translated into the locale of the application.
88+
For example, when using ``en`` as the locale, you'll get an array like
89+
``[..., 'cs' => 'Czech', ..., 'es' => 'Spanish', ..., 'zh' => 'Chinese']``.
90+
91+
If this option is ``true``, each choice value is translated into its own
92+
language. The resulting array is the same regardless of the application locale:
93+
``[..., 'cs' => 'čeština', ..., 'es' => 'español', ..., 'zh' => '中文']``.
94+
7795
.. include:: /reference/forms/types/options/choice_translation_locale.rst.inc
7896

7997
Overridden Options

0 commit comments

Comments
 (0)