fix strings.ts generation

This commit is contained in:
Florian Dold 2017-05-29 12:37:35 +02:00
parent 3f01c9490b
commit 9950c62579
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 10 additions and 5 deletions

View File

@ -49,6 +49,7 @@ const Stream = require("stream").Stream;
const vfs = require("vinyl-fs");
const webpack = require("webpack");
const po2json = require("po2json");
const path = require("path");
const paths = {
ts: {
@ -322,7 +323,11 @@ function pofilesToJs(targetPath) {
if (error) {
throw error;
}
const lang = file.stem;
const lang = path.basename(file.path, ".po");
if (!lang) {
throw Error();
}
console.log("lang", lang);
const pojson = po2json.parse(buf, {format: "jed1.x", fuzzy: true});
outStream.write("strings['" + lang + "'] = " + JSON.stringify(pojson, null, " ") + ";\n");
cb();

View File

@ -15,7 +15,7 @@
*/
export let strings: {[s: string]: any} = {};
strings['undefined'] = {
strings['de'] = {
"domain": "messages",
"locale_data": {
"messages": {
@ -174,7 +174,7 @@ strings['undefined'] = {
}
}
};
strings['undefined'] = {
strings['en-US'] = {
"domain": "messages",
"locale_data": {
"messages": {
@ -333,7 +333,7 @@ strings['undefined'] = {
}
}
};
strings['undefined'] = {
strings['fr'] = {
"domain": "messages",
"locale_data": {
"messages": {
@ -492,7 +492,7 @@ strings['undefined'] = {
}
}
};
strings['undefined'] = {
strings['it'] = {
"domain": "messages",
"locale_data": {
"messages": {