1+ // Type definitions for i18next v2.3.4
2+ // Project: http://i18next.com
3+ // Definitions by: Michael Ledin <https://github.com/mxl>
4+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5+
6+ // Sources: https://github.com/i18next/i18next/
7+
8+
9+ declare namespace I18next {
10+ interface ResourceStore {
11+ [ language : string ] : ResourceStoreLanguage ;
12+ }
13+
14+ interface ResourceStoreLanguage {
15+ [ namespace : string ] : ResourceStoreKey ;
16+ }
17+
18+ interface ResourceStoreKey {
19+ [ key : string ] : any ;
20+ }
21+
22+ interface InterpolationOptions {
23+ escapeValue ?: boolean ;
24+ prefix ?: string ;
25+ suffix ?: string ;
26+ prefixEscaped ?: string ;
27+ suffixEscaped ?: string ;
28+ unescapeSuffix ?: string ;
29+ unescapePrefix ?: string ;
30+ nestingPrefix ?: string ;
31+ nestingSuffix ?: string ;
32+ nestingPrefixEscaped ?: string ;
33+ nestedSuffixEscaped ?: string ;
34+ defaultVariables ?: any ;
35+ }
36+
37+ interface TranslationOptions {
38+ defaultValue ?: string ;
39+ count ?: number ;
40+ context ?: any ;
41+ replace ?: any ;
42+ lng ?:string ;
43+ lngs ?:string [ ] ;
44+ fallbackLng ?:string ;
45+ ns ?:string | string [ ] ;
46+ keySeparator ?:string ;
47+ nsSeparator ?:string ;
48+ returnObjects ?:boolean ;
49+ joinArrays ?:string ;
50+ postProcess ?:string | any [ ] ;
51+ interpolation ?: InterpolationOptions ;
52+ }
53+
54+ interface Options {
55+ debug ?: boolean ;
56+ resources ?: ResourceStore ;
57+ lng ?: string ;
58+ fallbackLng ?: string ;
59+ ns ?: string | string [ ] ;
60+ defaultNS ?: string ;
61+ fallbackNS ?: string | string [ ] ;
62+ whitelist ?:string [ ] ;
63+ lowerCaseLng ?: boolean ;
64+ load ?: string
65+ preload ?: string [ ] ;
66+ keySeparator ?: string ;
67+ nsSeparator ?: string ;
68+ pluralSeparator ?: string ;
69+ contextSeparator ?: string ;
70+ saveMissing ?: boolean ;
71+ saveMissingTo ?: string ;
72+ missingKeyHandler ?: ( lng :string , ns :string , key :string , fallbackValue :string ) => void ;
73+ parseMissingKeyHandler ?: ( key :string ) => void ;
74+ appendNamespaceToMissingKey ?: boolean ;
75+ postProcess ?: string | any [ ] ;
76+ returnNull ?: boolean ;
77+ returnEmptyString ?: boolean ;
78+ returnObjects ?: boolean ;
79+ returnedObjectHandler ?: ( key :string , value :string , options :any ) => void ;
80+ joinArrays ?: string ;
81+ overloadTranslationOptionHandler ?: ( args :any [ ] ) => TranslationOptions ;
82+ interpolation ?: InterpolationOptions ;
83+ detection ?: any ;
84+ backend ?: any ;
85+ cache ?: any ;
86+ }
87+
88+ type TranslationFunction = ( key :string , options ?:TranslationOptions ) => string ;
89+
90+ class I18n {
91+ constructor ( options ?:Options , callback ?:( err :any , t :TranslationFunction ) => void ) ;
92+
93+ init ( options ?:Options , callback ?:( err :any , t :TranslationFunction ) => void ) :I18n ;
94+
95+ loadResources ( callback ?:( err :any ) => void ) :void ;
96+
97+ use ( module :any ) :I18n ;
98+
99+ changeLanguage ( lng :string , callback ?:( err :any , t :TranslationFunction ) => void ) :void ;
100+
101+ getFixedT ( lng ?:string , ns ?:string | string [ ] ) :TranslationFunction ;
102+
103+ t ( key :string , options ?:TranslationOptions ) :string | any | Array < any > ;
104+
105+ exists ( ) :boolean ;
106+
107+ setDefaultNamespace ( ns :string ) :void ;
108+
109+ loadNamespaces ( ns :string [ ] , callback ?:( ) => void ) :void ;
110+
111+ loadLanguages ( lngs :string [ ] , callback ?:( ) => void ) :void ;
112+
113+ dir ( lng ?:string ) :string ;
114+
115+ createInstance ( options ?:Options , callback ?:( err :any , t :TranslationFunction ) => void ) :I18n ;
116+
117+ cloneInstance ( options ?:Options , callback ?:( err :any , t :TranslationFunction ) => void ) :I18n ;
118+ }
119+ }
120+
121+ declare module 'i18next' {
122+ var i18next :I18next . I18n ;
123+
124+ export default i18next ;
125+ }
0 commit comments