Skip to content

Commit 1ffa1cf

Browse files
authored
Add missing typescript definition for hash options (#315)
1 parent 697d89b commit 1ffa1cf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface DetectorOptions {
1515
* order and from where user language should be detected
1616
*/
1717
order?: Array<
18-
'querystring' | 'cookie' | 'sessionStorage' | 'localStorage' | 'navigator' | 'htmlTag' | string
18+
'querystring' | 'hash' | 'cookie' | 'sessionStorage' | 'localStorage' | 'navigator' | 'htmlTag' | string
1919
>;
2020

2121
/**
@@ -27,6 +27,8 @@ export interface DetectorOptions {
2727
lookupLocalStorage?: string;
2828
lookupFromPathIndex?: number;
2929
lookupFromSubdomainIndex?: number;
30+
lookupHash?: string;
31+
lookupFromHashIndex?: number;
3032

3133
/**
3234
* cache user language on

test/typescript/usage.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import i18next from 'i18next';
77

88
const options: DetectorOptions = {
99
// order and from where user language should be detected
10-
order: ['querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag'],
10+
order: ['querystring', 'hash', 'cookie', 'localStorage', 'navigator', 'htmlTag'],
1111

1212
// keys or params to lookup language from
1313
lookupQuerystring: 'lng',
1414
lookupCookie: 'i18next',
1515
lookupLocalStorage: 'i18nextLng',
16+
lookupHash: 'lng',
17+
lookupFromHashIndex: 0,
1618

1719
// cache user language on
1820
caches: ['localStorage', 'cookie'],

0 commit comments

Comments
 (0)