Skip to content

Commit

Permalink
- (chore) update packages
Browse files Browse the repository at this point in the history
- (refactor) use tsquery for querying AST
- (feat) autodetect usage of marker function and remove --marker cli argument
- (bugfix) extract strings when TranslateService is declared directly as a class parameter. Closes #83
- (bugfix) handle split strings: marker('hello ' + 'world') is now extracted as a single string: 'hello world'
  • Loading branch information
Kim Biesbjerg committed Sep 16, 2019
1 parent 41bd679 commit 4fe3c43
Show file tree
Hide file tree
Showing 13 changed files with 346 additions and 325 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ If you want to use spaces instead, you can do the following:
`ngx-translate-extract --input ./src --output ./src/i18n/en.json --format-indentation ' '`

## Mark strings for extraction using a marker function
If, for some reason, you want to extract strings not passed directly to `TranslateService`'s `get()` or `instant()` methods, you can wrap them in a custom marker function to let `ngx-translate-extract` know you want to extract them.
If, for some reason, you want to extract strings not passed directly to `TranslateService`'s `get()` or `instant()` methods, you can wrap them in a marker function to let `ngx-translate-extract` know you want to extract them.

Install marker function:
`npm install @biesbjerg/ngx-translate-extract-marker`
Expand Down Expand Up @@ -94,8 +94,6 @@ Options:
--output, -o Paths where you would like to save extracted
strings. You can use path expansion, glob patterns
and multiple paths [array] [required]
--marker, -m Extract strings passed to a marker function
[string] [default: false]
--format, -f Output format
[string] [choices: "json", "namespaced-json", "pot"] [default: "json"]
--format-indentation, --fi Output format indentation [string] [default: " "]
Expand Down
151 changes: 92 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@biesbjerg/ngx-translate-extract",
"version": "3.0.5",
"version": "4.0.0",
"description": "Extract strings from projects using ngx-translate",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -40,36 +40,38 @@
},
"homepage": "https://github.com/biesbjerg/ngx-translate-extract",
"engines": {
"node": ">=4.3.2"
"node": ">=8"
},
"config": {},
"devDependencies": {
"@types/chai": "^4.2.0",
"@types/chai": "^4.2.2",
"@types/flat": "^0.0.28",
"@types/glob": "^7.1.1",
"@types/mkdirp": "^0.5.2",
"@types/mocha": "^5.2.7",
"@types/node": "^12.7.5",
"@types/yargs": "^13.0.2",
"chai": "^4.2.0",
"mocha": "^6.2.0",
"ts-node": "^8.3.0",
"tslint": "^5.19.0",
"ts-node": "^8.4.1",
"tslint": "^5.20.0",
"tslint-eslint-rules": "^5.4.0"
},
"bundledDependencies": [
"flat"
],
"dependencies": {
"@angular/compiler": "^8.2.2",
"@angular/compiler": "^8.2.6",
"@phenomnomnominal/tsquery": "^3.0.0",
"boxen": "^4.1.0",
"colorette": "^1.1.0",
"flat": "github:lenchvolodymyr/flat#ffe77ef",
"gettext-parser": "^4.0.1",
"gettext-parser": "^4.0.2",
"glob": "^7.1.4",
"mkdirp": "^0.5.1",
"path": "^0.12.7",
"terminal-link": "^1.3.0",
"typescript": "^3.5.3",
"terminal-link": "^2.0.0",
"typescript": "^3.6.3",
"yargs": "^14.0.0"
}
}
Loading

0 comments on commit 4fe3c43

Please sign in to comment.