Compare commits

...

4 Commits

Author SHA1 Message Date
Kim Biesbjerg
bcb4a9c069 Fix bug where obsolete strings were not removed when --clean was used. Closes #29 2017-03-31 08:31:14 +02:00
Kim Biesbjerg
5ad1fe6a18 Remove unused import 2017-03-31 08:21:28 +02:00
Kim Biesbjerg
bc5ce7e80d Add marker argument to readme 2017-03-30 14:42:03 +02:00
Kim Biesbjerg
030ab145d6 Add return types 2017-03-30 14:40:51 +02:00
5 changed files with 9 additions and 9 deletions

View File

@@ -82,6 +82,8 @@ 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: "\t"]

View File

@@ -1,6 +1,6 @@
{
"name": "@biesbjerg/ngx-translate-extract",
"version": "2.2.0",
"version": "2.2.1",
"description": "Extract strings from projects using ngx-translate",
"main": "dist/index.js",
"typings": "dist/index.d.ts",

View File

@@ -104,7 +104,7 @@ export class ExtractTask implements TaskInterface {
if (this._options.clean) {
const collectionCount = processedCollection.count();
processedCollection = processedCollection.intersect(processedCollection);
processedCollection = processedCollection.intersect(collection);
const removeCount = collectionCount - processedCollection.count();
if (removeCount > 0) {
this._out(chalk.dim('- removed %d obsolete strings'), removeCount);

View File

@@ -48,7 +48,11 @@ export abstract class AbstractAstParser {
}, initialValue);
}
protected _printAllChildren(sourceFile: ts.SourceFile, node: ts.Node, depth = 0) {
protected _syntaxKindToName(kind: ts.SyntaxKind): string {
return ts.SyntaxKind[kind];
}
protected _printAllChildren(sourceFile: ts.SourceFile, node: ts.Node, depth = 0): void {
console.log(
new Array(depth + 1).join('----'),
`[${node.kind}]`,
@@ -62,8 +66,4 @@ export abstract class AbstractAstParser {
node.getChildren(sourceFile).forEach(childNode => this._printAllChildren(sourceFile, childNode, depth));
}
protected _syntaxKindToName(kind: ts.SyntaxKind) {
return ts.SyntaxKind[kind];
}
}

View File

@@ -1,5 +1,3 @@
import * as ts from 'typescript';
export function _(key: string | string[]): string | string[] {
return key;
}