JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2687
  • Score
    100M100P100Q120275F
  • License MIT

Webpack loader for https://github.com/messageformat/messageformat.js

Package Exports

  • messageformat-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (messageformat-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

messageformat.js loader for webpack

Dependencies

Install

npm install messageformat-loader

You'll also need another loader (like json-loader) to actually load the JSON strings

npm install json-loader

Usage

Documentation: Using loaders

Documentation: messageformat.js

messages.json

{
  "simple-example": "A simple message.",
  "var-example": "Message with {X}.",
  "plural-example": "You have {N, plural, =0{no messages} one{1 message} other{# messages}}.",
  "select-example": "{GENDER, select, male{He has} female{She has} other{They have}} sent you a message.",
  "ordinal-example": "The {N, selectordinal, one{1st} two{2nd} few{3rd} other{#th}} message."
}

example.js

var messages = require('messageformat!json!./messages.json');
messages['ordinal-example']({ N: 1 });
// => 'The 1st message.'

License

MIT