fix invalid options passed to gettext

This commit is contained in:
Kim Biesbjerg 2019-07-08 15:10:58 +02:00
parent c7563d4998
commit bc2bfac7d7

View File

@ -33,13 +33,13 @@ export class PoCompiler implements CompilerInterface {
} }
}; };
return gettext.po.compile(data, 'utf-8'); return gettext.po.compile(data);
} }
public parse(contents: string): TranslationCollection { public parse(contents: string): TranslationCollection {
const collection = new TranslationCollection(); const collection = new TranslationCollection();
const po = gettext.po.parse(contents, 'utf-8'); const po = gettext.po.parse(contents, 'utf8');
if (!po.translations.hasOwnProperty(this.domain)) { if (!po.translations.hasOwnProperty(this.domain)) {
return collection; return collection;
} }
@ -49,7 +49,7 @@ export class PoCompiler implements CompilerInterface {
.reduce((values, key) => { .reduce((values, key) => {
values[key] = po.translations[this.domain][key].msgstr.pop(); values[key] = po.translations[this.domain][key].msgstr.pop();
return values; return values;
}, <TranslationType> {}); }, {} as TranslationType);
return new TranslationCollection(values); return new TranslationCollection(values);
} }