1 | import * as i18next from 'i18next';
|
2 |
|
3 | interface DetectorOptions {
|
4 | |
5 |
|
6 |
|
7 | order?: Array<
|
8 | 'querystring' | 'cookie' | 'sessionStorage' | 'localStorage' | 'navigator' | 'htmlTag' | string
|
9 | >;
|
10 |
|
11 | |
12 |
|
13 |
|
14 | lookupQuerystring?: string;
|
15 | lookupCookie?: string;
|
16 | lookupSessionStorage?: string;
|
17 | lookupLocalStorage?: string;
|
18 | lookupFromPathIndex?: number;
|
19 | lookupFromSubdomainIndex?: number;
|
20 |
|
21 | |
22 |
|
23 |
|
24 | caches?: string[];
|
25 |
|
26 | |
27 |
|
28 |
|
29 | excludeCacheFor?: string[];
|
30 |
|
31 | |
32 |
|
33 |
|
34 |
|
35 | cookieMinutes?: number;
|
36 | cookieDomain?: string;
|
37 |
|
38 | |
39 |
|
40 |
|
41 |
|
42 | htmlTag?: HTMLElement | null;
|
43 | }
|
44 |
|
45 | interface CustomDetector {
|
46 | name: string;
|
47 | cacheUserLanguage?(lng: string, options: DetectorOptions): void;
|
48 | lookup(options: DetectorOptions): string | undefined;
|
49 | }
|
50 |
|
51 | export default class I18nextBrowserLanguageDetector implements i18next.LanguageDetectorModule {
|
52 | constructor(services?: any, options?: DetectorOptions);
|
53 | /**
|
54 | * Adds detector.
|
55 | */
|
56 | addDetector(detector: CustomDetector): I18nextBrowserLanguageDetector;
|
57 |
|
58 | /**
|
59 | * Initializes detector.
|
60 | */
|
61 | init(services?: any, options?: DetectorOptions): void;
|
62 |
|
63 | detect(detectionOrder?: DetectorOptions['order']): string | undefined;
|
64 |
|
65 | cacheUserLanguage(lng: string, caches?: string[]): void;
|
66 |
|
67 | type: 'languageDetector';
|
68 | detectors: { [key: string]: any };
|
69 | services: any;
|
70 | i18nOptions: any;
|
71 | }
|
72 |
|
73 | declare module 'i18next' {
|
74 | interface PluginOptions {
|
75 | detection?: DetectorOptions;
|
76 | }
|
77 | }
|