-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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.
<li>[[Runtime]] is an Object ...TODO</li> | ||
<li> | ||
[[RequestedLocales]] is a List of String values | ||
with the canonicalized language tags of the requested locales |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
- Make it easier for a custom function implementation to deal with its inputs. OTOH, it could call
Intl.getCanonicalLocales()
on itslocales
argument, so that's maybe not so important? - 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.
Co-authored-by: Daniel Minor <dminor@mozilla.com>
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.