1 | import type { i18n, ParseKeys, Namespace, TypeOptions, TOptions, TFunction } from 'i18next';
|
2 | import * as React from 'react';
|
3 |
|
4 | type _DefaultNamespace = TypeOptions['defaultNS'];
|
5 |
|
6 | type TransChild = React.ReactNode | Record<string, unknown>;
|
7 | export type TransProps<
|
8 | Key extends ParseKeys<Ns, TOpt, KPrefix>,
|
9 | Ns extends Namespace = _DefaultNamespace,
|
10 | KPrefix = undefined,
|
11 | TContext extends string | undefined = undefined,
|
12 | TOpt extends TOptions & { context?: TContext } = { context: TContext },
|
13 | E = React.HTMLProps<HTMLDivElement>,
|
14 | > = E & {
|
15 | children?: TransChild | readonly TransChild[];
|
16 | components?: readonly React.ReactElement[] | { readonly [tagName: string]: React.ReactElement };
|
17 | count?: number;
|
18 | context?: TContext;
|
19 | defaults?: string;
|
20 | i18n?: i18n;
|
21 | i18nKey?: Key | Key[];
|
22 | ns?: Ns;
|
23 | parent?: string | React.ComponentType<any> | null;
|
24 | tOptions?: TOpt;
|
25 | values?: {};
|
26 | shouldUnescape?: boolean;
|
27 | t?: TFunction<Ns, KPrefix>;
|
28 | };
|
29 |
|
30 | export function Trans<
|
31 | Key extends ParseKeys<Ns, TOpt, KPrefix>,
|
32 | Ns extends Namespace = _DefaultNamespace,
|
33 | KPrefix = undefined,
|
34 | TContext extends string | undefined = undefined,
|
35 | TOpt extends TOptions & { context?: TContext } = { context: TContext },
|
36 | E = React.HTMLProps<HTMLDivElement>,
|
37 | >(props: TransProps<Key, Ns, KPrefix, TContext, TOpt, E>): React.ReactElement;
|
38 |
|
39 | export type ErrorCode =
|
40 | | 'NO_I18NEXT_INSTANCE'
|
41 | | 'NO_LANGUAGES'
|
42 | | 'DEPRECATED_OPTION'
|
43 | | 'TRANS_NULL_VALUE'
|
44 | | 'TRANS_INVALID_OBJ'
|
45 | | 'TRANS_INVALID_VAR'
|
46 | | 'TRANS_INVALID_COMPONENTS';
|
47 |
|
48 | export type ErrorMeta = {
|
49 | code: ErrorCode;
|
50 | i18nKey?: string;
|
51 | [x: string]: any;
|
52 | };
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | export type ErrorArgs = readonly [string, ErrorMeta | undefined, ...any[]];
|