browserifyi18n
Browserify transform for internationalizing tagged strings
Install
$ npm install browserifyi18n
Usage
For standard, non-optimized usage, do:
var browserify = ;var i18n = ;var opts = locale: 'en' // The locale code to be used localeDirs: './path/to/locale/dir/' // Array of paths to locale .po files; ;
For optimized usage do:
var browserify = ;var i18n = ;var opts = // Normal browserify transform options go here; var fastOpts = locale: 'en' // The locale code to be used localeDirs: './path/to/locale/dir/' // Array of paths to locale .po files; ;
The optimized task is much faster because it only parses .po
files once,
instead of once for every browserified module.
To specify a custom interpolator for handlebars do:
var opts = locale: 'en' localeDirs: './path/to/locale/dir/' interpolateHbs: \tr\s"([\s\S]+?)"\g // Custom interpolation RegExp;
A custom interpolator for javascript can be configured by using the
interpolateJs
option.
Test
$ mocha