aboutsummaryrefslogtreecommitdiff
path: root/packages/pogen/src/po2ts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/pogen/src/po2ts.ts')
-rw-r--r--packages/pogen/src/po2ts.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/packages/pogen/src/po2ts.ts b/packages/pogen/src/po2ts.ts
index 7e831e6f8..d37bdb902 100644
--- a/packages/pogen/src/po2ts.ts
+++ b/packages/pogen/src/po2ts.ts
@@ -24,6 +24,8 @@ import * as fs from "fs";
import * as path from "path";
import glob = require("glob");
+const DEFAULT_STRING_PRELUDE = "export const strings: any = {};\n\n"
+
export function po2ts(): void {
const files = glob.sync("src/i18n/*.po");
@@ -34,9 +36,14 @@ export function po2ts(): void {
console.log(files);
- const chunks: string[] = [
- "export const strings: any = {};\n\n"
- ];
+ let prelude: string;
+ try {
+ prelude = fs.readFileSync("src/i18n/strings-prelude", "utf-8")
+ } catch (e) {
+ prelude = DEFAULT_STRING_PRELUDE
+ }
+
+ const chunks = [prelude];
for (const filename of files) {
const m = filename.match(/([a-zA-Z0-9-_]+).po/);