-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreact-localizer.d.ts
More file actions
36 lines (30 loc) · 1.14 KB
/
react-localizer.d.ts
File metadata and controls
36 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/// <reference types="react" />
import { string } from "prop-types";
declare module 'react-localizer' {
export interface TextProps extends React.HTMLAttributes<any> {
id?: string;
values?: { [i: string]: any }
component?: JSX.Element | React.ReactHTMLElement<any>;
children?: string | number,
html?: boolean,
}
export const Text: (props: TextProps) => JSX.Element;
export interface LocaleProviderProps {
children: any,
language?: string,
source: { [i: string]: any },
importer?: (language: string) => { [i: string]: any },
pluralize?: (language: string, args: any) => string
textParser?: (text: string, values: { [i: string]: any }) => string
}
export const LocaleProvider: (props: LocaleProviderProps) => JSX.Element;
export interface Locale {
get: (textId: string, variables?: { [i: string]: any }) => string;
setLanguage: (language: string) => void;
language: string;
}
export type WithLocale = {
locale: Locale
}
export const withLocale: <P = any>(component: any) => (props: P) => JSX.Element;
}