Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
import * as e from '@types/express'; | ||
|
||
declare module 'express-request-language' { | ||
interface Cookie { | ||
|
||
/** | ||
* Cookie name. | ||
*/ | ||
name: string; | ||
|
||
/** | ||
* Cookie option passed in `res.cookie(name, value, [options])`. | ||
*/ | ||
options?: e.CookieOptions; | ||
|
||
/** | ||
* URL to change preferred language. | ||
*/ | ||
url?: string; | ||
} | ||
|
||
interface Options { | ||
|
||
/** | ||
* Define your supported languages. | ||
*/ | ||
languages: string[]; | ||
|
||
/** | ||
* Query name used for changing language. | ||
*/ | ||
queryName?: string; | ||
|
||
/** | ||
* Cookie options. | ||
*/ | ||
cookie?: Cookie; | ||
|
||
/** | ||
* A localization import function. One of the supported languages will be passed as argument. | ||
* And the result will be set to `req.localization`. Very handy to be used with L10ns https://l10ns.org. | ||
*/ | ||
localizations?: (lang: string) => any; | ||
} | ||
|
||
/** | ||
* Middleware for language matching. | ||
*/ | ||
function requestLanguage(options: Options): any; | ||
export = requestLanguage; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters