Update node-gettext to v3 (#43522)

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2020-04-07 17:59:45 +02:00 committed by GitHub
parent 68698763ee
commit 9ac50b6e8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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;

View File

@ -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);