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

Simplify API #5

Merged
merged 3 commits into from
Feb 22, 2022
Merged

Simplify API #5

merged 3 commits into from
Feb 22, 2022

Conversation

eemeli
Copy link
Member

@eemeli eemeli commented Feb 17, 2022

This does a few things to simplify the proposed API, largely following recommendations from @sffc following last week's ECMA-402 presentation:

  1. Each Intl.MessageFormat instance is now built around a single message resource, at the cost of removing the ability for message references to refer outside their source resource.
  2. The Intl.MessageResource primordial is dropped.
  3. The format() method is dropped; its effects are similarly available as getMessage()?.toString()

@sffc
Copy link

sffc commented Feb 17, 2022

If you make this change, make sure it continues to align with the model of MFv2. My feedback from last week did not consider the full depth of the problem space.

@eemeli
Copy link
Member Author

eemeli commented Feb 17, 2022

Absolutely! This proposed change reflects corresponding changes in the ez-spec proposal for the Unicode MF2 spec, which was the only one of the current proposals that included cross-resource message references. That change in turn follows on from discussions earlier this week in the MFWG that covered the use cases for message references in detail, and arrived at a general sense that at least for non-local message references, their use cases may also be well served by user-definable custom functions.

This does enhance the importance of e.g. Intl.MessageFormat instances being memoizable, which actually turns out to be much easier with this slightly more limited API. I filed issue #6 here in part to work further towards that.

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.

lgtm!

@dminor dminor merged commit ffbceb0 into main Feb 22, 2022
@eemeli eemeli deleted the simplify branch February 22, 2022 14:12
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.

None yet

3 participants