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

    2.4.2 • 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

    // Type definitions for node-polyglot v2.4.0
    // Project: https://github.com/airbnb/polyglot.js
    // Definitions by: Tim Jackson-Kiely <https://github.com/timjk>
    //                 Liam Ross <https://github.com/liamross>
    //                 Michael Mok <https://github.com/pmmmwh>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    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;
        }
    
        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: Thu, 08 Jul 2021 18:51:23 GMT
    • Dependencies: none
    • Global values: none

    Credits

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

    Keywords

    none

    Install

    npm i @types/node-polyglot

    DownloadsWeekly Downloads

    14,473

    Version

    2.4.2

    License

    MIT

    Unpacked Size

    6.55 kB

    Total Files

    4

    Last publish

    Collaborators

    • types