Compare commits
14 Commits
refactor-p
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
a108eb776c | ||
|
a60ea65325 | ||
dd31950151 | |||
|
f0cc5a2d9f | ||
|
82eb652e4b | ||
|
4e91eb5fc5 | ||
|
0809e065ec | ||
|
17dfbbed84 | ||
|
acdffe0121 | ||
|
116133ba32 | ||
|
50b2ca6f4a | ||
|
b46a914756 | ||
|
bc3e5fbe2f | ||
|
ea990d6f9d |
@ -20,7 +20,7 @@ Add a script to your project's `package.json`:
|
||||
}
|
||||
...
|
||||
```
|
||||
You can now run `npm run extract-i18n` and it will extract strings from your project.
|
||||
You can now run `npm run i18n:extract` and it will extract strings from your project.
|
||||
|
||||
## Usage
|
||||
|
||||
@ -101,7 +101,8 @@ Examples:
|
||||
ngx-translate-extract -i './src/**/*.{ts,tsx,html}' -o strings.json Extract from ts, tsx and html
|
||||
ngx-translate-extract -i './src/**/!(*.spec).{ts,html}' -o Extract from ts, html, excluding files with ".spec"
|
||||
strings.json
|
||||
```
|
||||
|
||||
## Note for GetText users
|
||||
|
||||
Please pay attention of which version of `gettext-parser` you actually use in your project. For instance, `gettext-parser:1.2.2` does not support HTML tags in translation keys.
|
||||
Please pay attention of which version of `gettext-parser` you actually use in your project. For instance, `gettext-parser:1.2.2` does not support HTML tags in translation keys.
|
||||
|
1658
package-lock.json
generated
1658
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
52
package.json
52
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@biesbjerg/ngx-translate-extract",
|
||||
"version": "7.0.0",
|
||||
"version": "7.0.4",
|
||||
"description": "Extract strings from projects using ngx-translate",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
@ -61,44 +61,44 @@
|
||||
},
|
||||
"config": {},
|
||||
"devDependencies": {
|
||||
"@angular/compiler": "^9.1.9",
|
||||
"@angular/compiler": "^11.2.9",
|
||||
"@types/braces": "^3.0.0",
|
||||
"@types/chai": "^4.2.11",
|
||||
"@types/chai": "^4.2.16",
|
||||
"@types/flat": "^5.0.1",
|
||||
"@types/gettext-parser": "4.0.0",
|
||||
"@types/glob": "^7.1.1",
|
||||
"@types/mkdirp": "^1.0.0",
|
||||
"@types/mocha": "^7.0.2",
|
||||
"@types/node": "^12.12.42",
|
||||
"@types/yargs": "^15.0.5",
|
||||
"@types/glob": "^7.1.3",
|
||||
"@types/mkdirp": "^1.0.1",
|
||||
"@types/mocha": "^8.2.2",
|
||||
"@types/node": "^14.14.37",
|
||||
"@types/yargs": "^16.0.1",
|
||||
"braces": "^3.0.2",
|
||||
"chai": "^4.2.0",
|
||||
"husky": "^4.2.5",
|
||||
"lint-staged": "^10.2.6",
|
||||
"mocha": "^7.2.0",
|
||||
"prettier": "^2.0.5",
|
||||
"chai": "^4.3.4",
|
||||
"husky": "^6.0.0",
|
||||
"lint-staged": "^10.5.4",
|
||||
"mocha": "^8.3.2",
|
||||
"prettier": "^2.2.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-node": "^8.10.1",
|
||||
"tslint": "^6.1.2",
|
||||
"ts-node": "^9.1.1",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0",
|
||||
"tslint-eslint-rules": "^5.4.0",
|
||||
"tslint-etc": "^1.10.1",
|
||||
"typescript": "^3.9.3"
|
||||
"tslint-etc": "^1.13.9",
|
||||
"typescript": "^4.2.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/compiler": "^8.0.0 || ^9.0.0",
|
||||
"typescript": "^3.0.0"
|
||||
"@angular/compiler": ">=8.0.0",
|
||||
"typescript": ">=3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@phenomnomnominal/tsquery": "^4.1.0",
|
||||
"boxen": "^4.2.0",
|
||||
"colorette": "^1.2.0",
|
||||
"flat": "^5.0.0",
|
||||
"gettext-parser": "^4.0.3",
|
||||
"@phenomnomnominal/tsquery": "^4.1.1",
|
||||
"boxen": "^5.0.1",
|
||||
"colorette": "^1.2.2",
|
||||
"flat": "^5.0.2",
|
||||
"gettext-parser": "^4.0.4",
|
||||
"glob": "^7.1.6",
|
||||
"mkdirp": "^1.0.4",
|
||||
"path": "^0.12.7",
|
||||
"terminal-link": "^2.1.1",
|
||||
"yargs": "^15.3.1"
|
||||
"yargs": "^16.2.0"
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,8 @@ import {
|
||||
Binary,
|
||||
LiteralMap,
|
||||
LiteralArray,
|
||||
Interpolation
|
||||
Interpolation,
|
||||
MethodCall
|
||||
} from '@angular/compiler';
|
||||
|
||||
import { ParserInterface } from './parser.interface';
|
||||
@ -131,6 +132,10 @@ export class PipeParser implements ParserInterface {
|
||||
return this.getTranslatablesFromAsts(ast.expressions);
|
||||
}
|
||||
|
||||
if (ast instanceof MethodCall) {
|
||||
return this.getTranslatablesFromAsts(ast.args);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -195,4 +195,10 @@ describe('PipeParser', () => {
|
||||
const keys = parser.extract(contents, templateFilename).keys();
|
||||
expect(keys).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it('should extract strings from piped arguments inside a function calls on templates', () => {
|
||||
const contents = `{{ callMe('Hello' | translate, 'World' | translate ) }}`;
|
||||
const keys = parser.extract(contents, templateFilename).keys();
|
||||
expect(keys).to.deep.equal([`Hello`, `World`]);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user