diff --git a/pofile.d.ts b/pofile.d.ts index 0438cf2..dd61731 100644 --- a/pofile.d.ts +++ b/pofile.d.ts @@ -1,44 +1,45 @@ -declare module pofile { - function parse(data: string): PO; - function load(fileName: string, callback: (err: NodeJS.ErrnoException | null, po: PO) => void): void; - - class PO { - 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; - } +declare 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; + [name: string]: string; } -export = pofile +declare 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: Record; + private nplurals: number; + private obsolete: boolean; + + public toString(): string; +} + +declare class PO { + public comments: string[]; + public extractedComments: string[]; + public items: Item[]; + public headers: Partial + + public static parse(data: string): PO; + public static parsePluralForms(forms: string): PO; + public static load(fileName: string, callback: (err: NodeJS.ErrnoException, po: PO) => void): void; + public static Item: typeof Item; + + public save(fileName: string, callback: (err: NodeJS.ErrnoException) => void): void; + public toString(): string; +} + +export = PO