Skip to content

DiscoStarslayer/messageformat-webpack-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

License

MIT (http://www.opensource.org/licenses/mit-license.php)

About

Statically compile ICU Message strings into your bundle

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 100.0%