mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Update node-gettext to v3 (#43522)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
68698763ee
commit
9ac50b6e8a
8
types/node-gettext/index.d.ts
vendored
8
types/node-gettext/index.d.ts
vendored
@ -1,11 +1,11 @@
|
||||
// Type definitions for node-gettext 2.0
|
||||
// Type definitions for node-gettext 3.0
|
||||
// Project: http://github.com/alexanderwallin/node-gettext
|
||||
// Definitions by: Sameer K.C. <https://github.com/sameercaresu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
export = GetText;
|
||||
declare class GetText {
|
||||
constructor(options?: { debug: boolean; });
|
||||
constructor(options?: { debug?: boolean; sourceLocale?: string });
|
||||
addTranslations(locale: string, domain: string, translations: object): void;
|
||||
dgettext(domain: string, msgid: string): string;
|
||||
dngettext(domain: string, msgid: string, msgidPlural: string, count: number): string;
|
||||
@ -16,8 +16,8 @@ declare class GetText {
|
||||
gettext(msgid: string): string;
|
||||
ngettext(msgid: string, msgidPlural: string, count: number): string;
|
||||
npgettext(msgctxt: string, msgid: string, msgidPlural: string, count: number): string;
|
||||
off(eventName: 'error', callback: (error: string) => void): void;
|
||||
on(eventName: 'error', callback: (error: string) => void): void;
|
||||
off(eventName: 'error', callback: (error: any) => void): void;
|
||||
on(eventName: 'error', callback: (error: any) => void): void;
|
||||
pgettext(msgctxt: string, msgid: string): string;
|
||||
setLocale(locale: string): void;
|
||||
setTextDomain(domain: string): void;
|
||||
|
||||
@ -4,7 +4,7 @@ import Gettext from 'node-gettext';
|
||||
// import Gettext = require('node-getttext');
|
||||
|
||||
const translations = {};
|
||||
const gt = new Gettext({ debug: true });
|
||||
const gt = new Gettext({ debug: true, sourceLocale: 'en' });
|
||||
const msgid = 'Get translation';
|
||||
const msgidPlural = 'Get translations';
|
||||
const domain = 'domain';
|
||||
@ -26,7 +26,7 @@ gt.npgettext(msgctxt, msgid, msgidPlural, count);
|
||||
gt.pgettext(msgctxt, msgid);
|
||||
Gettext.getLanguageCode('en-US');
|
||||
gt.warn('warning');
|
||||
const errorListener = (error: string) => {
|
||||
const errorListener = (error: any) => {
|
||||
// do something;
|
||||
};
|
||||
gt.on('error', errorListener);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user