open-index/open-npm huggingface dataset:
npm package: @messageformat/fluent
Description: Conversion & compatibility tools for using Fluent with MessageFormat 2
Latest version: 0.14.0

# @messageformat/fluent

This library provides conversion and compatibility tools for using [Fluent] resources
with the [Unicode MessageFormat 2.0] -based [ECMA-402 Intl.MessageFormat proposal].

The Fluent message representation relies on [`@fluent/syntax`],
while the MessageFormat 2 representation uses [`messageformat`].

This package is distributed only as an ES module.

[fluent]: https://projectfluent.org/
[ecma-402 intl.messageformat proposal]: https://github.com/tc39/proposal-intl-messageformat
[unicode messageformat 2.0]: https://github.com/unicode-org/message-format-wg
[`@fluent/syntax`]: https://www.npmjs.com/package/@fluent/syntax
[`messageformat`]: https://www.npmjs.com/package/messageformat

## Usage

```sh
npm install @messageformat/fluent
```

```js
import { fluentToResource } from '@messageformat/fluent';

const locale = 'en-US';
const src = 'msg = Today is {DATETIME($today, dateStyle: "medium")}\n';

const resource = fluentToResource(locale, src);
const msg = resource.get('msg').get('');

msg.format({ today: new Date('2022-02-02') });
// 'Today is Feb 2, 2022'

msg.formatToParts({ today: new Date('2022-02-02') });
// [
//   { type: 'text', value: 'Today is ' },
//   {
//     type: 'datetime',
//     dir: 'ltr',
//     locale: 'en',
//     parts: [
//       { type: 'month', value: 'Feb' },
//       { type: 'literal', value: ' ' },
//       { type: 'day', value: '2' },
//       { type: 'literal', value: ', ' },
//       { type: 'year', value: '2022' }
//     ]
//   }
// ]
```

## API

```js
import {
  fluentToMessage,
  fluentToResource,
  fluentToResourceData,
  getMessageFunction,
  messageToFluent,
  resourceToFluent
} from '@messageformat/fluent';

import type {
  FluentMessageResource,
  FluentMessageResourceData
} from '@messageformat/fluent';
```

For more information, see the [documentation site](http://messageformat.github.io/).
npm package: @messageformat/icu-messageformat-1
Description: Compile ICU MessageFormat 1 sources into MessageFormat 2 formatters
Latest version: 0.12.0

# Compile ICU MessageFormat 1 sources into MessageFormat 2 formatters

This library provides compatibility for using ICU MessageFormat 1 sources with
the [Unicode MessageFormat 2.0] -based [ECMA-402 Intl.MessageFormat proposal].

[ecma-402 intl.messageformat proposal]: https://github.com/tc39/proposal-intl-messageformat
[unicode messageformat 2.0]: https://github.com/unicode-org/message-format-wg

## Usage

```sh
npm install @messageformat/icu-messageformat-1
```

```js
import { mf1ToMessage } from '@messageformat/icu-messageformat-1';

const locale = 'en-US';
const msg = 'Today is {today, date}';

const mf = mf1ToMessage(msg, locale);

mf.format({ today: new Date('2022-02-02') });
// 'Today is Feb 2, 2022'
```

## API

```js
import {
  MF1Functions,
  mf1ToMessage,
  mf1ToMessageData,
  mf1Validate
} from '@messageformat/icu-messageformat-1';
```

For more information, see the [documentation site](https://messageformat.github.io/).