Update readme
This commit is contained in:
parent
bfd069b755
commit
d3d6a72d5f
54
README.md
54
README.md
@ -34,14 +34,8 @@ You can now run `npm run extract-i18n` and it will extract strings from your pro
|
|||||||
|
|
||||||
**Extract and save to multiple files using path expansion**
|
**Extract and save to multiple files using path expansion**
|
||||||
|
|
||||||
_Note: This method does not work on Windows!_
|
|
||||||
|
|
||||||
`ngx-translate-extract --input ./src --output ./src/i18n/{da,en}.json`
|
`ngx-translate-extract --input ./src --output ./src/i18n/{da,en}.json`
|
||||||
|
|
||||||
On Windows you must specify each output destination individually:
|
|
||||||
|
|
||||||
`ngx-translate-extract --input ./src --output ./src/i18n/da.json ./src/i18n/en.json`
|
|
||||||
|
|
||||||
### JSON indentation
|
### JSON indentation
|
||||||
Tabs are used by default for indentation when saving extracted strings in json formats:
|
Tabs are used by default for indentation when saving extracted strings in json formats:
|
||||||
|
|
||||||
@ -76,29 +70,33 @@ _Note: `ngx-translate-extract` will automatically detect the import name_
|
|||||||
Usage:
|
Usage:
|
||||||
ngx-translate-extract [options]
|
ngx-translate-extract [options]
|
||||||
|
|
||||||
|
Output
|
||||||
|
--format, -f Format [string] [choices: "json", "namespaced-json", "pot"] [default: "json"]
|
||||||
|
--format-indentation, --fi Format indentation (JSON/Namedspaced JSON) [string] [default: " "]
|
||||||
|
--sort, -s Sort strings in alphabetical order [boolean]
|
||||||
|
--clean, -c Remove obsolete strings after merge [boolean]
|
||||||
|
--replace, -r Replace the contents of output file if it exists (Merges by default) [boolean]
|
||||||
|
|
||||||
|
Extracted key value (defaults to empty string)
|
||||||
|
--key-as-default-value, -k Use key as default value [boolean]
|
||||||
|
--null-as-default-value, -n Use null as default value [boolean]
|
||||||
|
--string-as-default-value, -d Use string as default value [string]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--version, -v Show version number [boolean]
|
--version, -v Show version number [boolean]
|
||||||
--help, -h Show help [boolean]
|
--help, -h Show help [boolean]
|
||||||
--input, -i Paths you would like to extract strings from. You
|
--input, -i Paths you would like to extract strings from. You can use path expansion, glob patterns and
|
||||||
can use path expansion, glob patterns and multiple
|
multiple paths [array] [required] [default: ["/Users/kim/apps/ngx-translate-extract"]]
|
||||||
paths
|
--output, -o Paths where you would like to save extracted strings. You can use path expansion, glob
|
||||||
[array] [default: current working path]
|
|
||||||
[array] [required] [default: current working path]
|
|
||||||
--patterns, -p Extract strings from the following file patterns
|
|
||||||
[array] [default: ["/**/*.html","/**/*.ts"]]
|
|
||||||
--output, -o Paths where you would like to save extracted
|
|
||||||
strings. You can use path expansion, glob
|
|
||||||
patterns and multiple paths [array] [required]
|
patterns and multiple paths [array] [required]
|
||||||
--format, -f Output format
|
|
||||||
[string] [choices: "json", "namespaced-json", "pot"] [default: "json"]
|
Examples:
|
||||||
--format-indentation, --fi Output format indentation [string] [default: " "]
|
cli.js -i ./src-a/ -i ./src-b/ -o strings.json Extract (ts, html) from multiple paths
|
||||||
--replace, -r Replace the contents of output file if it exists
|
cli.js -i './{src-a,src-b}/' -o strings.json Extract (ts, html) from multiple paths using brace
|
||||||
(Merges by default) [boolean]
|
expansion
|
||||||
--sort, -s Sort strings in alphabetical order when saving
|
cli.js -i ./src/ -o ./i18n/da.json -o ./i18n/en.json Extract (ts, html) and save to da.json and en.json
|
||||||
[boolean]
|
cli.js -i ./src/ -o './i18n/{en,da}.json' Extract (ts, html) and save to da.json and en.json
|
||||||
--clean, -c Remove obsolete strings when merging [boolean]
|
using brace expansion
|
||||||
--key-as-default-value, -k Use key as default value for translations
|
cli.js -i './src/**/*.{ts,tsx,html}' -o strings.json Extract from ts, tsx and html
|
||||||
[boolean]
|
cli.js -i './src/**/!(*.spec).{ts,html}' -o Extract from ts, html, excluding files with ".spec"
|
||||||
--null-as-default-value, -n Use null as default value for translations
|
strings.json
|
||||||
[boolean]
|
|
||||||
```
|
|
Loading…
Reference in New Issue
Block a user