mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
22 lines
705 B
TypeScript
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;
|