Add support for marker functions, to be able to extract strings not directly passed to TranslateService. Closes #10

This commit is contained in:
Kim Biesbjerg
2017-03-30 14:37:30 +02:00
parent 42a6568d47
commit daaebede6f
11 changed files with 213 additions and 90 deletions

View File

@@ -1,19 +0,0 @@
import * as ts from 'typescript';
export function printAllChildren(sourceFile: ts.SourceFile, node: ts.Node, depth = 0) {
console.log(
new Array(depth + 1).join('----'),
`[${node.kind}]`,
syntaxKindToName(node.kind),
`[pos: ${node.pos}-${node.end}]`,
':\t\t\t',
node.getFullText(sourceFile).trim()
);
depth++;
node.getChildren(sourceFile).forEach(childNode => printAllChildren(sourceFile, childNode, depth));
}
export function syntaxKindToName(kind: ts.SyntaxKind) {
return ts.SyntaxKind[kind];
}

5
src/utils/utils.ts Normal file
View File

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