0.1.1 • Published 8 years ago
messageformat-webpack-plugin v0.1.1
MessageFormat Plugin for Webpack
Statically compile ICU Message strings into your bundle
Usage
Add to your plugins in the webpack config
var MessageFormatPlugin = require("messageformat-webpack-plugin");
var languages = {
en: { hello: 'Hello, {name}!' }
}
{
plugins: [
new MessageFormatPlugin('en', languages)
]
}
Now you can statically compile ICU Message strings into your project like so:
console.log(__('hello', { name: 'world' })) // 'Hello, world!'
Since this is done at compile time, it is not able to handle variables, only literals. See Yahoo Intl-MessageFormat for more usage examples.