diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-02-22 10:25:11 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-02-22 10:25:11 +0100 |
commit | 42eb17e7e021476227b846d45cc43409aa451b6e (patch) | |
tree | 2a962ee3100aae83c83d27b471d2199ac8954065 /tooling/pogen | |
parent | b15f40aea5adcfed4d7ed499ec01988955bdc929 (diff) | |
download | wallet-core-42eb17e7e021476227b846d45cc43409aa451b6e.tar.xz |
i18n fixes
Diffstat (limited to 'tooling/pogen')
-rw-r--r-- | tooling/pogen/pogen.js | 12 | ||||
-rw-r--r-- | tooling/pogen/pogen.ts | 12 |
2 files changed, 6 insertions, 18 deletions
diff --git a/tooling/pogen/pogen.js b/tooling/pogen/pogen.js index 787a7ec7e..ed634ef0d 100644 --- a/tooling/pogen/pogen.js +++ b/tooling/pogen/pogen.js @@ -188,14 +188,8 @@ function processFile(sourceFile) { case ts.SyntaxKind.JsxText: { var e = childNode; - var s = e.getText(); - var t = s.split("\n").map(trim).join("\n"); - if (s.length >= 1 && (s[0] === "\n" || s[0] === " ")) { - t = " " + t; - } - if (s.length >= 1 && (s[s.length - 1] === "\n" || s[s.length - 1] === " ")) { - t = t + " "; - } + var s = e.getFullText(); + var t = s.split("\n").map(trim).join(" "); fragments.push(t); } case ts.SyntaxKind.JsxOpeningElement: @@ -218,7 +212,7 @@ function processFile(sourceFile) { } }; ts.forEachChild(node, process); - return fragments.join(""); + return fragments.join("").trim().replace(/ +/g, " "); } function getJsxSingular(node) { var res; diff --git a/tooling/pogen/pogen.ts b/tooling/pogen/pogen.ts index 0903b9db7..391843912 100644 --- a/tooling/pogen/pogen.ts +++ b/tooling/pogen/pogen.ts @@ -211,14 +211,8 @@ export function processFile(sourceFile: ts.SourceFile) { case ts.SyntaxKind.JsxText: { let e = childNode as ts.JsxText; - let s = e.getText(); - let t = s.split("\n").map(trim).join("\n"); - if (s.length >= 1 && (s[0] === "\n" || s[0] === " ")) { - t = " " + t; - } - if (s.length >= 1 && (s[s.length-1] === "\n" || s[s.length-1] === " ")) { - t = t + " "; - } + let s = e.getFullText(); + let t = s.split("\n").map(trim).join(" "); fragments.push(t); } case ts.SyntaxKind.JsxOpeningElement: @@ -241,7 +235,7 @@ export function processFile(sourceFile: ts.SourceFile) { } }; ts.forEachChild(node, process); - return fragments.join(""); + return fragments.join("").trim().replace(/ +/g, " "); } function getJsxSingular(node: ts.Node) { |