forked from i18next/next-i18next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
67 lines (61 loc) · 1.59 KB
/
types.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
/* tslint:disable no-explicit-any */
import {
I18nContext,
useTranslation,
Trans,
withTranslation,
WithTranslation as ReactI18nextWithTranslation,
DefaultNamespace,
Translation,
} from 'react-i18next'
import { InitOptions, i18n as I18NextClient, TFunction as I18NextTFunction } from 'i18next'
import { appWithTranslation, i18n } from './'
type NextJsI18NConfig = {
defaultLocale: string
locales: string[]
}
export type UserConfig = {
i18n: NextJsI18NConfig
localeExtension?: string
localePath?:
string | ((locale: string, namespace: string, missing: boolean) => string)
localeStructure?: string
onPreInitI18next?: (i18n: I18n) => void
reloadOnPrerender?: boolean
serializeConfig?: boolean
use?: any[]
} & InitOptions
export type InternalConfig = Omit<UserConfig, 'i18n'> & NextJsI18NConfig & {
errorStackTraceLimit: number
preload: string[]
supportedLngs: string[]
}
export type UseTranslation = typeof useTranslation
export type AppWithTranslation = typeof appWithTranslation
export type TFunction = I18NextTFunction
export type I18n = I18NextClient
export type WithTranslationHocType = typeof withTranslation
export type WithTranslation = ReactI18nextWithTranslation
export type InitPromise = Promise<TFunction>
export type CreateClientReturn = {
i18n: I18n
initPromise: InitPromise
}
export type SSRConfig = {
_nextI18Next: {
initialI18nStore: any
initialLocale: string
ns: string[]
userConfig: UserConfig | null
}
}
export {
i18n,
I18nContext,
appWithTranslation,
useTranslation,
Trans,
Translation,
withTranslation,
DefaultNamespace,
}