A brunch plugin for messageformat.js.
-
Add
"messageformat-brunch": "git://github.com/bc-luke/messageformat-brunch.git"topackage.jsonof your brunch app. -
Create a directory named
langand sub-directories using the language key, e.g.en. -
Place messageformat/JSON-encoded language files for a particular language in the directory with the corresponding language key, e.g.
lang/en/foo/bar.json. -
Configure your brunch application to compile the json files into the location of your choice using the templates key, e.g.
templates: joinTo: 'javascripts/app.js': /^app\/templates/ 'javascripts/i18n/en.js': /^app\/lang\/en\/.*\.json/ 'javascripts/i18n/fr.js': /^app\/lang\/fr\/.*\.json/ -
Call messageformat functions using
window.i18n['foo/bar']['messageKey']({ARG1: 1, ARG2: 2}).