2.3.6 • Published 6 months ago

@types/preact-i18n v2.3.6

Weekly downloads
245
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/preact-i18n

Summary

This package contains type definitions for preact-i18n (https://github.com/synacor/preact-i18n).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/preact-i18n.

index.d.ts

// Type definitions for preact-i18n 2.3
// Project: https://github.com/synacor/preact-i18n
// Definitions by:  Lukas Tetzlaff <https://github.com/ltetzlaff>
//                  Sascha Zarhuber <https://github.com/saschazar21>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.5

import { h, Component, Context, VNode, ComponentChild, JSX } from 'preact';

interface IntlContext {
    intl: {
        definition: {};
        mark: boolean;
        scope: string;
    };
}

interface IntlProviderProps {
    children: JSX.Element | JSX.Element[];
    definition?: {} | undefined;
    mark?: boolean | undefined;
    scope?: string | undefined;
}

interface LocalizerProps {
    children: JSX.Element | JSX.Element[];
}
interface TextProps {
    children?: string | undefined;
    id: string;
    fields?: {} | undefined;
    plural?: number | undefined;
}

export const IntlContext: Context<IntlContext>;

export function IntlProvider(props: IntlProviderProps): JSX.Element;

export function Text(props: TextProps): JSX.Element;

export function MarkupText(props: TextProps): JSX.Element;

export function Localizer(props: LocalizerProps): JSX.Element;

export function translate(
    id: string,
    scope: string,
    dictionary: {},
    fields?: {},
    plural?: number,
    fallback?: string,
): string;

export function useText(
    mapping: { [key: string]: string | JSX.Element } | string | JSX.Element,
): { [key: string]: string };

// tslint:disable-next-line:no-unnecessary-generics
export function withText<Props, Context = IntlContext>(mapping: {}): (
    Child: ComponentChild,
    // tslint:disable-next-line:no-unnecessary-generics
) => new (props?: Props, context?: Context) => any;

export function intl(Child: Component, options?: { scope?: string | undefined; definition?: {} | undefined }): VNode;

declare enum Intl {
    intl,
    IntlContext,
    IntlProvider,
    Text,
    MarkupText,
    Localizer,
    withText,
    useText,
    translate,
}

export default Intl;

Additional Details

  • Last updated: Thu, 08 Jul 2021 20:19:48 GMT
  • Dependencies: @types/preact
  • Global values: none

Credits

These definitions were written by Lukas Tetzlaff, and Sascha Zarhuber.

2.3.4

8 months ago

2.3.3

9 months ago

2.3.6

6 months ago

2.3.5

7 months ago

2.3.2

1 year ago

2.3.1

3 years ago

2.3.0

3 years ago

1.2.0

5 years ago