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

Update & expand spec text to cover fallback values and pattern selection #35

Merged
merged 10 commits into from
Dec 16, 2023

Conversation

eemeli
Copy link
Member

@eemeli eemeli commented Dec 2, 2023

I finally found some time to expand the spec text here. It's intended to be implementing the behaviour described in the README, as well as following the MF2 spec.

The text I'm proposing here makes explicit reference to not just the MF2 syntax, but also the JSON Schema definition of its data model. To be specific, the data model after the changes of unicode-org/message-format-wg#548 get merged. Is that sort of reference acceptable?

I'm also proposing to define the SelectVariant abstract operation as "implementation-defined", and to refer for its internals to the Pattern Selection section of the Unicode MessageFormat 2.0 specification. Is that ok? The language defining the algorithm there isn't exactly TC39-ese, but it's very close.

This still leaves the GetMessageFunctions() and ResolveExpression() abstract operations as TODO, and they're hiding probably at least as much spec behind them as I've got written down so far.

@eemeli eemeli requested review from dminor and ryzokuken December 2, 2023 20:05
Copy link
Member

@ryzokuken ryzokuken left a comment

Choose a reason for hiding this comment

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

LGTM, thanks. Minor comments inline.

spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
Copy link
Collaborator

@dminor dminor left a comment

Choose a reason for hiding this comment

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

This looks good to me.

spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
<li>[[Runtime]] is an Object ...TODO</li>
<li>
[[RequestedLocales]] is a List of String values
with the canonicalized language tags of the requested locales
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since RequestedLocales is user provided, do we want to canonicalize here rather than preserve what the user provided? It would be nice to not have to preserve the user data, but I'm wondering if this could end up surprising someone?

Copy link
Member Author

Choose a reason for hiding this comment

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

My thinking was that canonicalization would do two beneficial things:

  1. Make it easier for a custom function implementation to deal with its inputs. OTOH, it could call Intl.getCanonicalLocales() on its locales argument, so that's maybe not so important?
  2. Make invalid locale tags produce a constructor error, rather than leaving it until a later format() call. AFAIK this matches what happens with all other Intl formatters.

@eemeli eemeli merged commit b93097c into main Dec 16, 2023
1 check passed
@eemeli eemeli deleted the update-spec-text branch December 16, 2023 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants