forked from Tiqa/redux-polyglot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
53 lines (43 loc) · 1.39 KB
/
types.d.ts
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import Polyglot from 'node-polyglot';
declare module '@cabify/redux-polyglot' {
type PolyglotInterpolationOptions = Polyglot.InterpolationOptions;
type translate = (
phrase: string,
smartCountOrInterpolationOptions?: number | PolyglotInterpolationOptions
) => string;
interface SimpleAction {
type: string;
payload: {
[varName: string]: any;
};
}
type getLocaleFunction = (action: SimpleAction) => string;
type getPhrasesFunction = (locale: string) => Promise<any>;
interface ReduxPolyglot {
t: translate;
tc: translate;
tm: translate;
tu: translate;
ut: translate;
has: (scope: string) => boolean;
locale: () => string;
extend: (phrases: any) => void;
getDeeperScope: (scope: string) => ReduxPolyglot;
}
function getP(state: any, options?: getPParams): ReduxPolyglot;
interface getPParams{
polyglotScope: string;
[any: string]: any;
}
function createPolyglotMiddleware(
actionsToCatch: [string],
getLocale: getLocaleFunction,
getPhrases: getPhrasesFunction
);
interface PolyglotState {
locale: string | null;
phrases: any;
}
function polyglotReducer(state: PolyglotState, action: SimpleAction): PolyglotState;
function useP(config?: getPParams): ReduxPolyglot;
}