forked from i18next/next-i18next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
84 lines (75 loc) · 2.19 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* tslint:disable no-explicit-any */
import * as React from 'react'
import {
I18nContext,
useTranslation,
TransProps,
withTranslation,
WithTranslation as ReactI18nextWithTranslation
} from 'react-i18next'
import { LinkProps } from 'next/link'
import { Request } from 'express'
import { SingletonRouter } from 'next/router'
import { InitOptions, i18n, TFunction as I18NextTFunction } from 'i18next'
export type InitConfig = {
browserLanguageDetection?: boolean;
serverLanguageDetection?: boolean;
strictMode?: boolean;
defaultLanguage: string;
ignoreRoutes?: string[];
localeExtension?: string;
localePath?: string;
localeStructure?: string;
otherLanguages: string[];
localeSubpaths?: Record<string, string>;
use?: any[];
customDetectors?: any[];
shallowRender?: boolean;
} & InitOptions
export type Config = {
fallbackLng: boolean;
allLanguages: string[];
// https://github.com/i18next/i18next/blob/master/CHANGELOG.md#1950
supportedLngs: string[];
// temporal backwards compatibility WHITELIST REMOVAL
whitelist: string[];
// end temporal backwards compatibility WHITELIST REMOVAL
preload: string[];
} & InitConfig
export interface NextI18NextInternals {
config: Config;
i18n: I18n;
}
export type Trans = (props: TransProps) => any
export type Link = React.ComponentClass<LinkProps>
export type Router = SingletonRouter
export type UseTranslation = typeof useTranslation
export type AppWithTranslation = <P extends object>(Component: React.ComponentType<P> | React.ElementType<P>) => any
export type TFunction = I18NextTFunction
export type I18n = i18n
export type WithTranslationHocType = typeof withTranslation
export type WithTranslation = ReactI18nextWithTranslation
export type InitPromise = Promise<TFunction>
export {
I18nContext,
withTranslation,
}
declare class NextI18Next {
constructor(config: InitConfig);
Trans: Trans
Link: Link
Router: Router
i18n: I18n
initPromise: InitPromise
config: Config
useTranslation: UseTranslation
withTranslation: WithTranslationHocType
appWithTranslation: AppWithTranslation
}
export type NextI18NextRequest = Request & {
i18n?: I18n & {
options: Config;
};
lng?: string;
}
export default NextI18Next