From e038f25d5b8778c3b5c463745ae4f3717b034dc0 Mon Sep 17 00:00:00 2001 From: Maciej Bukowski Date: Mon, 13 Mar 2017 17:40:01 +0100 Subject: [PATCH] Added support for the typescript projects and IDE-s. --- package.json | 1 + pofile.d.ts | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 pofile.d.ts diff --git a/package.json b/package.json index e888269..5c7686e 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "url": "http://github.com/rubenv/pofile.git" }, "main": "./lib/po", + "types": "./pofile.d.ts", "keywords": [ "i18n", "l10n", diff --git a/pofile.d.ts b/pofile.d.ts new file mode 100644 index 0000000..0f291cc --- /dev/null +++ b/pofile.d.ts @@ -0,0 +1,44 @@ +declare module "pofile" { + class PO { + public static parse(data: string): PO; + public static load(fileName: string, callback: (err: NodeJS.ErrnoException | null, po: PO) => void): void; + + public comments: string[]; + public extractedComments: string[]; + public items: Item[]; + public headers: Partial + + public save(filename: string, callback: (err?: NodeJS.ErrnoException) => void): void; + public toString(): string; + } + + interface IHeaders { + 'Project-Id-Version': string; + 'Report-Msgid-Bugs-To': string; + 'POT-Creation-Date': string; + 'PO-Revision-Date': string; + 'Last-Translator': string; + 'Language': string; + 'Language-Team': string; + 'Content-Type': string; + 'Content-Transfer-Encoding': string; + 'Plural-Forms': string; + } + + class Item { + public msgid: string; + public msgctxt?: string; + public references: string[]; + public msgid_plural?: string; + public msgstr: string[]; + public comments: string[]; + public extractedComments: string[]; + public flags: { [flag: string]: boolean | undefined } + private nplurals: number; + private obsolete: boolean; + + public toString(): string; + } + + export = PO; +}