forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
i18next-browser-languagedetector.d.ts
85 lines (73 loc) · 2.25 KB
/
i18next-browser-languagedetector.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
85
// Type definitions for i18next-browser-languagedetector 0.0.14
// Project: http://i18next.com/
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../i18next/i18next-2.0.17.d.ts"/>
declare namespace I18next {
interface I18nextStatic extends i18nextBrowserLanguageDetector.I18nextStatic { }
interface I18nextOptions extends i18nextBrowserLanguageDetector.I18nextOptions { }
}
declare namespace i18nextBrowserLanguageDetector {
/**
* @summary Interface for Language detector options.
* @interface
*/
interface LanguageDetectorOptions {
caches?: Array<string>|boolean;
cookieDomain?: string;
cookieExpirationDate?: Date;
lookupCookie?: string;
lookupFromPathIndex?: number;
lookupQuerystring?: string;
lookupSession?: string;
order?: Array<string>;
}
/**
* @summary Interface for custom detector.
* @interface
*/
interface CustomDetector {
name: string;
//todo: Checks paramters type.
cacheUserLanguage: (lng: string, options: Object) => void;
lookup: (options: Object) => string;
}
/**
* @summary i18next options.
* @interface
*/
interface I18nextOptions {
detection?: LanguageDetectorOptions;
}
/**
* @summary i18next interface.
* @interface
*/
interface I18nextStatic {
use(module: LngDetector): I18nextStatic;
}
/**
* @summary i18next language detection.
* @class
*/
class LngDetector {
/**
* @summary Constructor.
* @constructor
*/
constructor(services?: any, options?: LanguageDetectorOptions);
/**
* @summary Adds detector.
* @param {CustomDetector} detector The custom detector.
*/
addDetector(detector: CustomDetector): LngDetector;
/**
* @summary Initializes detector.
* @param {LanguageDetectorOptions} options The options.
*/
init(options?: LanguageDetectorOptions): void;
}
}
declare module "i18next-browser-languagedetector" {
export default i18nextBrowserLanguageDetector.LngDetector;
}