Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

feat($locale): Include original locale ID in $locale #13390

Closed
wants to merge 1 commit into from
Closed

feat($locale): Include original locale ID in $locale #13390

wants to merge 1 commit into from

Conversation

philBrown
Copy link
Contributor

Most systems use IETF language tag codes which are typically a combination of the ISO 639 language code and ISO 3166-1 country code with an underscore or hyphen delimiter. For example en_US, en_AU, etc.

Whilst the $locale.id comes close, the lowercase format makes it impossible to transform to an IETF tag reliably. For example, it would be impossible to deduce en_Dsrt_US from en-dsrt-us.

It would be very handy for communicating with external systems to be able to pass the IETF tag format, at least with the character casing intact.

Most systems use *IETF language tag* codes which are typically a combination of the ISO 639 language code and ISO 3166-1 country code with an underscore or hyphen delimiter. For example `en_US`, `en_AU`, etc.

Whilst the `$locale.id` comes close, the lowercase format makes it impossible to transform to an IETF tag reliably. For example, it would be impossible to deduce `en_Dsrt_US` from `en-dsrt-us`.

It would be very handy for communicating with external systems to be able to pass the IETF tag format, at least with the character casing intact.
@petebacondarwin
Copy link
Member

@philBrown this doesn't actually work, since if you look further down the file the localeObj is never used. I have an alternative fix, with a unit test that gives you what you need.

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this pull request Jan 26, 2016
Most systems use *IETF language tag* codes which are typically a combination
of the ISO 639 language code and ISO 3166-1 country code with an underscore
or hyphen delimiter. For example `en_US`, `en_AU`, etc.

Whilst the `$locale.id` comes close, the lowercase format makes it impossible
to transform to an IETF tag reliably. For example, it would be impossible
to deduce `en_Dsrt_US` from `en-dsrt-us`.

Closes angular#13390
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this pull request Jan 26, 2016
@petebacondarwin petebacondarwin mentioned this pull request Jan 26, 2016
@petebacondarwin
Copy link
Member

@gkalpak points out that your fix does indeed work, but since the code itself is weird, it will be better to fix it in the way I have done in the PR.

petebacondarwin added a commit that referenced this pull request Jan 26, 2016
Most systems use *IETF language tag* codes which are typically a combination
of the ISO 639 language code and ISO 3166-1 country code with an underscore
or hyphen delimiter. For example `en_US`, `en_AU`, etc.

Whilst the `$locale.id` comes close, the lowercase format makes it impossible
to transform to an IETF tag reliably. For example, it would be impossible
to deduce `en_Dsrt_US` from `en-dsrt-us`.

Closes #13390
petebacondarwin added a commit that referenced this pull request Jan 26, 2016
Most systems use *IETF language tag* codes which are typically a combination
of the ISO 639 language code and ISO 3166-1 country code with an underscore
or hyphen delimiter. For example `en_US`, `en_AU`, etc.

Whilst the `$locale.id` comes close, the lowercase format makes it impossible
to transform to an IETF tag reliably. For example, it would be impossible
to deduce `en_Dsrt_US` from `en-dsrt-us`.

Closes #13390
@philBrown philBrown deleted the patch-2 branch January 26, 2016 23:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants