Skip to content

Constraints on @locale values #452

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

Closed
aphillips opened this issue Aug 15, 2023 · 7 comments · Fixed by #846
Closed

Constraints on @locale values #452

aphillips opened this issue Aug 15, 2023 · 7 comments · Fixed by #846
Labels
design Design document or issues related to design Future Deferred for future standardization question Further information is requested Stale Obsolete? syntax Issues related with syntax or ABNF

Comments

@aphillips
Copy link
Member

In #450 we are considering the addition of a contextual expression attribute for the locale. Currently this says that the values must be a BCP47 language tag (or comma-separated sequence of tags, e.g. a language priority list). We should agree on the level of validation for conformance.

Generally speaking, we should probably require well-formed tags (according to BCP47's understanding of well-formed), at least at the syntax level.
We could require that the tags be valid (this requires checking that the subtags are in the registry)
We could require that the tags be valid Unicode Locale Identifiers (ULIs) (which has further canonicalization requirements)

Writing this issue to provide a separate place to discuss.

@aphillips aphillips changed the title Constraints on \@locale values Constraints on @locale values Aug 15, 2023
@aphillips aphillips added question Further information is requested syntax Issues related with syntax or ABNF design Design document or issues related to design labels Aug 15, 2023
@macchiati
Copy link
Member

@aphillips
Copy link
Member Author

@macchiati ULIs are one of the options listed. I do note that the requirements on ULIs have the disadvantage of not being strictly linked to the BCP47 grammar, that is, it is necessary to process the tag to know if it conforms. Implementations may not all have the ability to do the necessary validation and canonicalization. Perhaps we could say something like:

The value of a locale attribute MUST be a sequence of well-formed BCP47 language tags.
Each language tag SHOULD be a valid Unicode Locale Identifier (ULI)

@eemeli
Copy link
Collaborator

eemeli commented Aug 27, 2023

I'm not completely certain how to express it, but in practice the JS implementation will almost certainly apply this validation to language tags as that's what we use for the formatter's locales argument.

So any spec text which allows for that practice to continue would be good.

@aphillips
Copy link
Member Author

@eemeli That validation is ULI (although it's probably not a good thing that it is separate from Unicode's definition, given that one or the other might change...)

I'm hesitant to require every implementation everywhere to use ULI simply because some implementations won't support the various extensions and such--but can still use the language tag bits.

Many specifications "require" users to be more strict than what implementations are required to enforce. The way to say that would be:

The value of a locale MUST be a sequence of valid Unicode Locale Identifiers.
Implementations are only required to validate that each ULI language tag is a well-formed BCP47 language tag.

@aphillips aphillips added the LDML45 LDML45 Release (Tech Preview) label Jan 8, 2024
@aphillips
Copy link
Member Author

Depends on expression attributes being accepted (#450)

@aphillips aphillips added Future Deferred for future standardization and removed LDML45 LDML45 Release (Tech Preview) labels Jan 19, 2024
@aphillips
Copy link
Member Author

We decided to make expression attributes reserved for future standardization. As a result, this item is out of scope for LDML45.

@aphillips aphillips added the Stale Obsolete? label Sep 9, 2024
@aphillips
Copy link
Member Author

@locale was replaced by :u:locale so this is obsolete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design document or issues related to design Future Deferred for future standardization question Further information is requested Stale Obsolete? syntax Issues related with syntax or ABNF
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants