Skip to content
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

Editorial: Add GetLocaleBaseName abstract operation #915

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

anba
Copy link
Contributor

@anba anba commented Aug 5, 2024

Add GetLocaleBaseName to avoid repeating the same steps to extract the unicode_language_id parts of a unicode_locale_id. The abstract operation is named to GetLocaleBaseName to match the accessor property Intl.Locale.prototype.baseName.

Add `GetLocaleBaseName` to avoid repeating the same steps to extract the
`unicode_language_id` parts of a `unicode_locale_id`. The abstract
operation is named to `GetLocaleBaseName` to match the accessor property
`Intl.Locale.prototype.baseName`.
1. If _variants_ is not *undefined*, set _newLanguageId_ to the string-concatenation of _newLanguageId_, *"-"*, and _variants_.
1. Let _newTag_ be _tag_ with the <emu-not-ref>substring</emu-not-ref> matched by the <code>unicode_language_id</code> Unicode locale nonterminal replaced by the string _newLanguageId_.
1. Let _variants_ be GetLocaleVariants(_baseName_).
1. Let _allExtensions_ be the suffix of _tag_ following _baseName_.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking the suffix string matches the approach taken in IsStructurallyValidLanguageTag. This also let's us avoid having to reference unicode_language_id below and we can instead use simple string concatenation.

Copy link
Contributor

@ben-allen ben-allen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is essentially an approve — I have a couple of questions, but I suspect they're based on me missing subtleties about spec language rather than actual editorial problems

spec/locale.html Show resolved Hide resolved
spec/locale.html Show resolved Hide resolved
@ben-allen ben-allen added the editorial Involves an editorial fix label Aug 22, 2024
@ben-allen ben-allen merged commit 60eda81 into tc39:main Sep 12, 2024
2 checks passed
@anba anba deleted the locale-basename branch November 11, 2024 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial Involves an editorial fix
Projects
Status: Previously Discussed
Development

Successfully merging this pull request may close these issues.

2 participants