babel-plugin-format-message
babel plugin to replace formatMessage calls with translations.
Installation
$ npm install babel-plugin-format-message
Usage
This plugin isn't terribly useful without configuration, so you probably won't
add it via the .babelrc
or CLI.
Via Node API
var formatMessagePlugin = ;;
Via webpack loader
var formatMessagePlugin = ;moduleexports = "en" "pt" "de" ;
Via browserify / babelify
var b = ;
Example options
See format-message for full options documentation.
functionName: "formatMessage" // identifier of function to inline locale: locale // default locale { // from call formatMessage(pattern, args, locales) // if no locales were passed to format, locales will be the default locale (specified above) return pattern; } translations: // or rather than a translate function, lookup from an object pt: ... de: ... keyType: "underscored_crc32" // or "underscored", "normalized", or "literal", default is "underscored_crc32" missingTranslation: "warning" // warn instead of fatal error, default is "error", can also be "ignore" missingReplacement: "!!NOT TRANSLATED!!" // use this when no translation found, default is the original pattern
License
This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.