Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Fix two issues with grandfathered tags #57

Closed
wants to merge 2 commits into from
Closed

Conversation

littledan
Copy link
Member

This is a follow-up to #50, to remove an error check which is
now subsumed by a later conditional.

Closes #52
@anba
Copy link
Contributor

anba commented Aug 17, 2018

This doesn't like right, because it means new Intl.Locale("zh-min", {language: "zh-min-nan", region: "CN"}).toString() returns "nan-CN", whereas new Intl.Locale("zh", {language: "zh-min-nan", region: "CN"}) will throw a RangeError.

I think we should keep step 4.b and throw a RangeError if the "language" option is a grandfathered tag.

Also kind of related, #50 made ApplyOptionsToTag more complicated, because now it's necessary to detect and throw a RangeError for things like new Intl.Locale("en-gaulish", {language: "cel", region: "FR"}) ("en" is replaced with "cel", which changes the tag to "cel-gaulish", so a grandfathered tag. And then the current spec requires to throw a RangeError when attempting to add the region "FR" to this grandfathered tag.)

@littledan
Copy link
Member Author

We agreed on this in https://github.com/tc39/ecma402/blob/master/meetings/notes-2018-08-16.md but I need to take a closer look at the issue @anba raised above.

@littledan
Copy link
Member Author

littledan commented Sep 18, 2018

I think we should keep step 4.b and throw a RangeError if the "language" option is a grandfathered tag.

If I understood correctly, @srl295 has been arguing for nicer handling in edge cases like these. I wonder what he thinks about @anba's proposal.

Also kind of related, #50 made ApplyOptionsToTag more complicated, because now it's necessary to detect and throw a RangeError for things like new Intl.Locale("en-gaulish", {language: "cel", region: "FR"}) ("en" is replaced with "cel", which changes the tag to "cel-gaulish", so a grandfathered tag. And then the current spec requires to throw a RangeError when attempting to add the region "FR" to this grandfathered tag.)

Do you have a recommendation for what we should do in a case like this?

I'm really not happy about all the complexity that we're taking in due to grandfathered tags; it seems like we're doing a lot of work for edge cases where there's been a specific decision not to focus on an older representation. Is there any way we can avoid this?

@littledan
Copy link
Member Author

Would be obsoleted by #66

@littledan
Copy link
Member Author

OK, I think this PR is subsumed by the later work about Unicode BCP 47 Locale Identifiers.

@littledan littledan closed this Jan 22, 2019
@ljharb ljharb deleted the grandfathered branch January 24, 2022 20:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants