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

Discussion Issue for the Approval Ballot #954

Open
aphillips opened this issue Nov 20, 2024 · 4 comments
Open

Discussion Issue for the Approval Ballot #954

aphillips opened this issue Nov 20, 2024 · 4 comments
Labels
LDML46.1 MF2.0 Draft Candidate meta

Comments

@aphillips
Copy link
Member

aphillips commented Nov 20, 2024

This issue is for the discussion of the Working Group Ballot of the MF2.0 approval found in #955

  • This is the place to explain your "Approve" or "Disapprove" vote.
  • File individual issues for technical problems, editorial issues (such as spelling), or other topics orthogonal to whether we should approve the specification.
@eemeli
Copy link
Collaborator

eemeli commented Nov 21, 2024

For those of you playing along at home, the latest prerelease version of the JS messageformat library implements the current version of the spec, including everything except for :unit.

npm install --save-exact messageformat@next
import { MessageFormat } from 'messageformat'

const msg = new MessageFormat('en', '{$cost :currency u:locale=fi}');
const cost = { valueOf: () => 42, options: { currency: 'EUR' } };
msg.format({ cost });  // '42,00 €'

msg.format({ cost: 42 });  // '{$cost}'
// Warning: A currency code is required for :currency

msg.formatToParts({ cost });  // see below
[
  {
    type: 'number',
    source: '$cost',
    dir: 'ltr',
    locale: 'fi',
    parts: [
      { type: 'integer', value: '42' },
      { type: 'decimal', value: ',' },
      { type: 'fraction', value: '00' },
      { type: 'literal', value: ' ' },
      { type: 'currency', value: '€' }
    ]
  }
]

@gibson042

This comment was marked as off-topic.

@sffc
Copy link
Member

sffc commented Nov 25, 2024

FWIW, I'm still not a fan of that deep structure, and much prefer a flattened representation as in the existing Intl APIs such as DateTimeFormat.prototype.formatRangeToParts.

I agree with this, but it does not have to do with MessageFormat 2.0, right? That has to do with Intl.MessageFormat. I don't see where in MessageFormat 2.0 it defines formatToParts.

@gibson042

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LDML46.1 MF2.0 Draft Candidate meta
Projects
None yet
Development

No branches or pull requests

4 participants