From f04f620cff870ffc0e5fd3348215f1ef5916ca30 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 30 Nov 2013 09:40:10 +0100 Subject: [PATCH 1/2] Improve ISO code references --- book/translation.rst | 8 ++++---- components/translation/introduction.rst | 8 ++++---- reference/constraints/Country.rst | 4 +++- reference/constraints/Language.rst | 4 +++- reference/constraints/Locale.rst | 7 +++++-- reference/forms/types/locale.rst | 10 +++++++--- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/book/translation.rst b/book/translation.rst index 6756c15345a..6158073ac22 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -22,8 +22,8 @@ into the language of the user:: The term *locale* refers roughly to the user's language and country. It can be any string that your application uses to manage translations and - other format differences (e.g. currency format). The `ISO639-1`_ - *language* code, an underscore (``_``), then the `ISO3166 Alpha-2`_ + other format differences (e.g. currency format). The `ISO 639-1`_ + *language* code, an underscore (``_``), then the `ISO 3166-1 alpha-2`_ *country* code (e.g. ``fr_FR`` for French/France) is recommended. In this chapter, you'll learn how to use the Translation component in the @@ -673,6 +673,6 @@ steps: be set on the user's session. .. _`i18n`: http://en.wikipedia.org/wiki/Internationalization_and_localization -.. _`ISO3166 Alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes -.. _`ISO639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes +.. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes +.. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes .. _`Translatable Extension`: https://github.com/l3pp4rd/DoctrineExtensions diff --git a/components/translation/introduction.rst b/components/translation/introduction.rst index fb76f103650..9ccc34c74ed 100644 --- a/components/translation/introduction.rst +++ b/components/translation/introduction.rst @@ -45,8 +45,8 @@ The constructor of the ``Translator`` class needs one argument: The locale. The term *locale* refers roughly to the user's language and country. It can be any string that your application uses to manage translations and - other format differences (e.g. currency format). The `ISO639-1`_ - *language* code, an underscore (``_``), then the `ISO3166 Alpha-2`_ + other format differences (e.g. currency format). The `ISO 639-1`_ + *language* code, an underscore (``_``), then the `ISO 3166-1 alpha-2`_ *country* code (e.g. ``fr_FR`` for French/France) is recommended. .. _component-translator-message-catalogs: @@ -206,5 +206,5 @@ Usage Read how to use the Translation component in :doc:`/components/translation/usage`. .. _Packagist: https://packagist.org/packages/symfony/translation -.. _`ISO3166 Alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes -.. _`ISO639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes +.. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes +.. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes diff --git a/reference/constraints/Country.rst b/reference/constraints/Country.rst index 507a8d2164e..86efb4636eb 100644 --- a/reference/constraints/Country.rst +++ b/reference/constraints/Country.rst @@ -1,7 +1,7 @@ Country ======= -Validates that a value is a valid two-letter country code. +Validates that a value is a valid `ISO 3166-1 alpha-2`_ country code. +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | @@ -81,3 +81,5 @@ message **type**: ``string`` **default**: ``This value is not a valid country.`` This message is shown if the string is not a valid country code. + +.. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes diff --git a/reference/constraints/Language.rst b/reference/constraints/Language.rst index 32616abcce5..0ec1e7a9495 100644 --- a/reference/constraints/Language.rst +++ b/reference/constraints/Language.rst @@ -1,7 +1,7 @@ Language ======== -Validates that a value is a valid language code. +Validates that a value is a valid `ISO 639-1`_ language code. +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | @@ -81,3 +81,5 @@ message **type**: ``string`` **default**: ``This value is not a valid language.`` This message is shown if the string is not a valid language code. + +.. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes diff --git a/reference/constraints/Locale.rst b/reference/constraints/Locale.rst index 6e4cda3ba65..9bb4f1a35ca 100644 --- a/reference/constraints/Locale.rst +++ b/reference/constraints/Locale.rst @@ -3,9 +3,9 @@ Locale Validates that a value is a valid locale. -The "value" for each locale is either the two letter ISO639-1 *language* code +The "value" for each locale is either the two letter `ISO 639-1`_ *language* code (e.g. ``fr``), or the language code followed by an underscore (``_``), then -the ISO3166 *country* code (e.g. ``fr_FR`` for French/France). +the `ISO 3166-1 alpha-2`_ *country* code (e.g. ``fr_FR`` for French/France). +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | @@ -85,3 +85,6 @@ message **type**: ``string`` **default**: ``This value is not a valid locale.`` This message is shown if the string is not a valid locale. + +.. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes +.. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes diff --git a/reference/forms/types/locale.rst b/reference/forms/types/locale.rst index 818515da8c4..4bee1a16c49 100644 --- a/reference/forms/types/locale.rst +++ b/reference/forms/types/locale.rst @@ -8,9 +8,10 @@ The ``locale`` type is a subset of the ``ChoiceType`` that allows the user to select from a large list of locales (language+country). As an added bonus, the locale names are displayed in the language of the user. -The "value" for each locale is either the two letter ISO639-1 *language* code -(e.g. ``fr``), or the language code followed by an underscore (``_``), then -the ISO3166 *country* code (e.g. ``fr_FR`` for French/France). +The "value" for each locale is either the two letter `ISO 639-1`_ *language* +code (e.g. ``fr``), or the language code followed by an underscore (``_``), +then the `ISO 3166-1 alpha-2`_ *country* code (e.g. ``fr_FR`` +for French/France). .. note:: @@ -85,3 +86,6 @@ These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/disabled.rst.inc .. include:: /reference/forms/types/options/mapped.rst.inc + +.. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes +.. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes From 405f040206b8f573446f33b31fc7e9683347e4e9 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 30 Nov 2013 15:45:22 +0100 Subject: [PATCH 2/2] Update language field/constraint --- reference/constraints/Language.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/reference/constraints/Language.rst b/reference/constraints/Language.rst index 0ec1e7a9495..b8a87fbd500 100644 --- a/reference/constraints/Language.rst +++ b/reference/constraints/Language.rst @@ -1,7 +1,8 @@ Language ======== -Validates that a value is a valid `ISO 639-1`_ language code. +Validates that a value is a valid language *Unicode language identifier* +(e.g. ``fr`` or ``zh-Hant``). +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | @@ -81,5 +82,3 @@ message **type**: ``string`` **default**: ``This value is not a valid language.`` This message is shown if the string is not a valid language code. - -.. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes