6.2.4 • Published 4 years ago
babel-plugin-transform-format-message v6.2.4
babel-plugin-transform-format-message
Pre-generate ids from default messages or inline a single language translation
Installation
$ npm install babel-plugin-transform-format-messageUsage
Via .babelrc (Recommended)
.babelrc
{
"plugins": [ "transform-format-message", {
"generateId": "underscored_crc32",
"inline": false
} ]
}Via CLI
$ babel --plugins transform-format-message script.jsVia Node API
require("babel-core").transform("code", {
plugins: [
[ "transform-format-message", {
"generateId": "underscored_crc32",
"translations": "./locales",
"locale": "pt-BR"
} ]
]
})Options
generateIdis either a functionstring -> string, or one of"literal","normalized","underscored","underscored_crc32". Default is"underscored_crc32".inlineis a boolean. If true, the full translated message will be inlined and optimized, otherwise only generated ids will be added. Default isfalse.localeis the BCP 47 Language Tag string specifying the target language to inline. This is only used withinline: true. Default is"en".translationsis an object of the form:{ [locale]: { [id]: { message: '...' }, ... } }. This is an object with keys for each locale, with values matching theextract-format-messagejson output. This can also be a string path to require a module that exports a matching object.missingTranslationis one of"ignore","warning","error". Default is"warning".missingReplacementis an optional string to use in place of missing translations. By default the default message will be used.
License
This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.
6.2.4
4 years ago
6.2.3
6 years ago
6.2.2
6 years ago
6.2.1
7 years ago
6.2.0
7 years ago
6.1.0
7 years ago
6.0.4
7 years ago
6.0.3
8 years ago
6.0.2
8 years ago
6.0.1
8 years ago
6.0.0
8 years ago
6.0.0-alpha.2
8 years ago
6.0.0-alpha.1
8 years ago
6.0.0-alpha.0
8 years ago
5.2.6
8 years ago
5.2.5
8 years ago
5.2.3
8 years ago
5.2.1
8 years ago
5.2.0
8 years ago
5.1.4
9 years ago
5.1.3
9 years ago
5.1.2
9 years ago
5.1.1
9 years ago
5.1.0
9 years ago
5.0.0
9 years ago
5.0.0-beta.10
9 years ago
5.0.0-beta.9
9 years ago
5.0.0-beta.8
9 years ago
5.0.0-beta.6
9 years ago
5.0.0-beta.5
9 years ago
5.0.0-beta.4
9 years ago
5.0.0-beta.3
9 years ago
5.0.0-beta.1
9 years ago
5.0.0-beta.0
9 years ago
4.1.0
9 years ago
4.0.0
10 years ago