-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[RFC] [Validator] Suggest to apply \Locale::canonicalize()
before validating with Locale
constraint
#7660
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
Labels
Comments
As a side note, and to add more reasons for this suggestion, the referenced article at Wikipedia for ISO 3166-1 alpha-2 doesn't mention anything about the separator to use between the language and country codes. |
Will be a feature implemented in 4.1 (see referenced PR). |
fabpot
added a commit
to symfony/symfony
that referenced
this issue
Feb 7, 2018
…idator (phansys) This PR was squashed before being merged into the 4.1-dev branch (closes #22353). Discussion ---------- [Validator] Add `canonicalize` option for `Locale` validator |Q |A | |--- |--- | |Branch |master| |Bug fix? |no | |New feature? |yes | |BC breaks? |no | |Deprecations?|no | |Tests pass? |yes | |Fixed tickets|n/a | |License |MIT | |Doc PR |n/a | Allow non canonicalized locales ('fr-FR' by instance) to pass the validation. Relates to symfony/symfony-docs#7660. Commits ------- 39dfa3d [Validator] Add option for LANG="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL= validator
javiereguiluz
added a commit
that referenced
this issue
Feb 23, 2018
…` validation constraint (phansys, javiereguiluz) This PR was merged into the master branch. Discussion ---------- [Validator] Add docs for "canonicalize" option at `Locale` validation constraint Related to symfony/symfony#22353, symfony/symfony#26075. Closes #7660. Commits ------- 14f10bc Final changes 4c28e1f Minor changes 0cc4ee8 Add docs for "canonicalize" option at `Locale` validation constraint
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be nice to have a note about
\Locale::canonicalize()
within theLocale
constraint documentation, since many times locales are expressed using other "uncanonicalized" formats. By instance, a common use case is to infer the locale from javascript, wherenavigator.language
returns values like "en-US" instead of "en_US"; making theLocale
constraint to fail.The canonicalization process is explained at ICU project.
The text was updated successfully, but these errors were encountered: