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

Canonicalization between ApplyOptionsToTag and ApplyUnicodeExtensionToTag with grandfathered tags #17

Closed
anba opened this issue Feb 9, 2018 · 2 comments

Comments

@anba
Copy link
Contributor

anba commented Feb 9, 2018

Consider this example:

var loc = new Intl.Locale("en-gb-oed", {region: "US", calendar: "gregory"});
print(loc.toString()); "en-GB-oxendict-u-ca-gregory"

If a grandfathered tag has a modern replacement, calling CanonicalizeLanguageTag will change the grandfathered tag into a normal langtag language tag. And that means options applied in ApplyOptionsToTag are ignored, but options applied in ApplyUnicodeExtensionToTag are used. Do we want to support this behaviour or do we rather want to ignore all options if the original input was a grandfathered language tag?

@Ms2ger
Copy link
Contributor

Ms2ger commented May 3, 2018

The strange thing is that passing the Locale object through the constructor again with the same options yields a different result:

var options = {region: "US", calendar: "gregory"}
var loc = new Intl.Locale("en-gb-oed", options);
var loc2 = new Intl.Locale(loc, options);
assert.sameValue(loc.toString(), loc2.toString())
// Expected SameValue(«en-GB-oxendict-u-ca-gregory», «en-US-oxendict-u-ca-gregory») to be true

Should we perhaps canonicalize the grandfathered tags first?

@littledan
Copy link
Member

@anba

And that means options applied in ApplyOptionsToTag are ignored, but options applied in ApplyUnicodeExtensionToTag are used.

Oops, good catch.

@Ms2ger

Should we perhaps canonicalize the grandfathered tags first?

This sounds like a good idea. Should we do this by adding an additional CanonicalizeLanguageTag call to the top of ApplyOptionsToTag? If we add this additional call, does it remove the need for the existing call, or do we need both?

littledan added a commit that referenced this issue Jul 15, 2018
- Options which can't be applied to private use or grandfathered tags,
  whether script, region or Unicode extensions, trigger a RangeError
  in the constructor. (Closes #25 and #12)
- Insert additional calls to CanonicalizeLanguageTag for grandfathered
  tags, to enable options to be applied. (Closes #17)
- For grandfathered or private use tags, the entire tag is treated
  as the "language", both for the purposes of the
  Intl.Locale.prototype.language getter and for the language property
  of the options bag in the constructor.
  (Follows #25 (comment))
littledan added a commit that referenced this issue Jul 28, 2018
- Options which can't be applied to private use or grandfathered tags,
  whether script, region or Unicode extensions, trigger a RangeError
  in the constructor. (Closes #25 and #12)
- Insert additional calls to CanonicalizeLanguageTag for grandfathered
  tags, to enable options to be applied. (Closes #17)
- For grandfathered or private use tags, the entire tag is treated
  as the "language", both for the purposes of the
  Intl.Locale.prototype.language getter and for the language property
  of the options bag in the constructor.
  (Follows #25 (comment))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants