@types/node-polyglot
TypeScript icon, indicating that this package has built-in type declarations

2.5.0 • Public • Published

Installation

npm install --save @types/node-polyglot

Summary

This package contains type definitions for node-polyglot (https://github.com/airbnb/polyglot.js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-polyglot.

index.d.ts

declare namespace Polyglot {
    interface InterpolationOptions {
        smart_count?: number | { length: number } | undefined;
        _?: string | undefined;

        [interpolationKey: string]: any;
    }

    interface InterpolationTokenOptions {
        prefix?: string | undefined;
        suffix?: string | undefined;
    }

    interface PluralRules {
        pluralTypes: { [lang: string]: (n: number) => number };
        pluralTypeToLanguages: { [lang: string]: string[] };
    }

    interface PolyglotOptions {
        phrases?: any;
        locale?: string | undefined;
        allowMissing?: boolean | undefined;
        onMissingKey?: ((key: string, options: Polyglot.InterpolationOptions, locale: string) => string) | undefined;
        warn?: ((message: string) => void) | undefined;
        interpolation?: InterpolationTokenOptions | undefined;
        pluralRules?: PluralRules | undefined;
        replace?:
            | ((
                this: string,
                interpolationRegex: RegExp,
                replacer: (substring: string, ...args: any[]) => string,
            ) => string | string[])
            | undefined;
    }

    function transformPhrase(phrase: string, options?: number | Polyglot.InterpolationOptions, locale?: string): string;
}

declare class Polyglot {
    constructor(options?: Polyglot.PolyglotOptions);

    extend(phrases: any, prefix?: string): void;

    t(phrase: string, options?: number | Polyglot.InterpolationOptions): string;

    clear(): void;

    replace(phrases: any): void;

    locale(locale?: string): string;

    has(phrase: string): boolean;

    unset(phrases: any, prefix?: string): void;
}

export = Polyglot;

Additional Details

  • Last updated: Sat, 25 Nov 2023 01:28:55 GMT
  • Dependencies: none

Credits

These definitions were written by Tim Jackson-Kiely, Liam Ross, and Michael Mok.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/node-polyglot

Weekly Downloads

26,183

Version

2.5.0

License

MIT

Unpacked Size

6.33 kB

Total Files

5

Last publish

Collaborators

  • types