DefinitelyTyped/node-polyglot/index.d.ts
Jean-Philippe Lachance 652c54beeb + Add the allowMissing parameter in PolyglotOptions (#13757)
+ Add the onMissingKey parameter in PolyglotOptions
2017-01-12 09:42:44 -08:00

44 lines
1.0 KiB
TypeScript

// Type definitions for node-polyglot v0.4.1
// Project: https://github.com/airbnb/polyglot.js
// Definitions by: Tim Jackson-Kiely <https://github.com/timjk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Polyglot {
interface InterpolationOptions {
smart_count?: number | { length: number };
_?: string;
[interpolationKey: string]: any;
}
interface PolyglotOptions {
phrases?: any;
locale?: string;
allowMissing?: boolean;
onMissingKey?: (key: string, options?: Polyglot.InterpolationOptions, locale?: string) => string;
}
}
declare class Polyglot {
constructor(options?: Polyglot.PolyglotOptions);
extend(phrases: any): void;
t(phrase: string): string;
t(phrase: string, smartCount: number): string;
t(phrase: string, interpolationOptions: Polyglot.InterpolationOptions): string;
clear(): void;
replace(phrases: any): void;
locale(): string;
locale(locale: string): void;
}
export = Polyglot;