DefinitelyTyped/types/gettext-parser/gettext-parser-tests.ts
2020-03-31 15:27:23 -07:00

22 lines
705 B
TypeScript

import { po, mo } from 'gettext-parser';
let parsed = po.parse("foo", "utf-8");
let compiled = po.compile(parsed, {});
parsed = po.parse(Buffer.from("bar"));
compiled = po.compile(parsed, { anyOption: false });
parsed = mo.parse(compiled, "wrong-charset");
compiled = mo.compile(parsed, { noOption: 3 });
const charset: string = parsed.charset;
const firstHeader: string = parsed.headers["firstHeader"];
const firstHeaderAsString: string = firstHeader;
const firstTranslation = parsed.translations["firstContext"]["firstTranslation"];
firstTranslation.msgctxt = firstHeaderAsString;
firstTranslation.msgid = charset;
firstTranslation.msgid_plural;
firstTranslation.msgstr;
firstTranslation.comments;