diff --git a/.all-contributorsrc b/.all-contributorsrc
index 3a876df..1d17d3f 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -132,6 +132,15 @@
"contributions": [
"example"
]
+ },
+ {
+ "login": "testower",
+ "name": "Tom Erik Støwer",
+ "avatar_url": "https://avatars2.githubusercontent.com/u/231492?v=4",
+ "profile": "https://github.com/testower",
+ "contributions": [
+ "code"
+ ]
}
],
"repoType": "github",
diff --git a/cli.js b/cli.js
index dff5183..d2d8a11 100755
--- a/cli.js
+++ b/cli.js
@@ -10,11 +10,12 @@ const cli = meow(
$ extract-messages
Options
- -o, --output Output directory [require: true]
- -l, --locales locales [require: true]
- -f, --format json | yaml [default: json]
- -d, --default-locale default locale
- --flat json [default: true] | yaml [default: false]
+ -o, --output Output directory [require: true]
+ -l, --locales locales [require: true]
+ -f, --format json | yaml [default: json]
+ -d, --default-locale default locale
+ --overwriteDefault default: false
+ --flat json [default: true] | yaml [default: false]
Example
$ extract-messages --locales=ja,en --output app/translations 'app/**/*.js'
@@ -42,6 +43,10 @@ const cli = meow(
type: 'string',
alias: 'd'
},
+ overwriteDefault: {
+ type: 'boolean',
+ default: true
+ },
withDescriptions: {
type: 'boolean',
default: false
diff --git a/readme.md b/readme.md
index 2dbbf63..b2a486f 100644
--- a/readme.md
+++ b/readme.md
@@ -4,7 +4,7 @@
[](https://github.com/facebook/jest)
[](https://github.com/prettier/prettier)
[](./license)
-[](#contributors-)
+[](#contributors-)
This package will generate json or yaml files from a glob. It will generate one file per locale, with the ids of each message defined by the [`defineMessages`](https://github.com/yahoo/react-intl/wiki/API#definemessages) function of [react-intl](https://github.com/yahoo/react-intl). The value of each of these keys will be an empty string, except for your `defaultLocale` which will be populated with the [`defaultMessage`](https://github.com/yahoo/react-intl/wiki/API#message-descriptor).
@@ -96,12 +96,12 @@ $ extract-messages --help
$ extract-messages
Options
- -o, --output Output directory [require: true]
- -l, --locales locales [require: true]
- -f, --format json|yaml [default: json]
- --flat json [default: true] | yaml [default: false]
- --default-locale default locale [default: en]
- --moduleSourceName module source name from where components are imported [default: react-intl]
+ -o, --output Output directory [require: true]
+ -l, --locales locales [require: true]
+ -f, --format json | yaml [default: json]
+ -d, --default-locale default locale
+ --overwriteDefault default: false
+ --flat json [default: true] | yaml [default: false]
Example
$ extract-messages --locales=ja,en --output app/translations 'app/**/*.js'
@@ -163,6 +163,13 @@ Default: `json`
Set extension to output.
+##### overwriteDefault
+
+Type: `boolean`
+Default: true
+
+If overwriteDefault is `false`, it will not overwrite messages in the default locale.
+
##### flat
Type: `boolean`
@@ -201,6 +208,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds