Skip to content

Commit

Permalink
doc: locales arg can accept a string (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzokuken authored Oct 3, 2023
1 parent ee36c8c commit c38c3a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ In code, with the API proposed below, this would be used like this:

```js
const source = ... // string source of the message as above
const mf = new Intl.MessageFormat(source, ["en"]);
const mf = new Intl.MessageFormat(source, "en");
const notifications = mf.format({ count: 1 });
// 'You have 1 new notification'
```
Expand All @@ -71,11 +71,11 @@ those are of course also supported by the proposed API:

```js
// A plain message
const mf1 = new Intl.MessageFormat("{Hello!}", ["en"]);
const mf1 = new Intl.MessageFormat("{Hello!}", "en");
mf1.format(); // 'Hello!'

// A parametric message, formatted to parts
const mf2 = new Intl.MessageFormat("{Hello {$place}!}", ["en"]);
const mf2 = new Intl.MessageFormat("{Hello {$place}!}", "en");
const greet = mf.formatToParts({ place: 'world' });
/* [
{ type: 'literal', value: 'Hello ' },
Expand Down

0 comments on commit c38c3a5

Please sign in to comment.