npm install --save @types/express-simple-locale
This package contains type definitions for express-simple-locale (https://github.com/n26/express-simple-locale#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-simple-locale.
import express = require("express");
import { RequestHandler } from "express";
declare module "express-serve-static-core" {
interface Request {
userLocale: locale.ShortLocale;
}
}
/**
* A simple Express middleware to guess the short-locale of a user.
* It then saves the found locale on the request for further usage.
*/
declare function locale(options?: locale.Options): RequestHandler;
declare namespace locale {
/**
* @see {@link https://github.com/n26/express-simple-locale#options}
*/
interface Options {
/**
* the key to save locale to on the request
* @default 'locale'
*/
key?: string | undefined;
/**
* available locales for the app
* @default []
*/
supportedLocales?: string[] | undefined;
/**
* locale to fallback to
* @default 'en'
*/
defaultLocale?: string | undefined;
/**
* cookie to try getting the locale from
* @default 'locale'
*/
cookieName?: string | undefined;
/**
* the query parameter(s) to look the locale from
* @default ['locale']
*/
queryParams?: string | string[] | undefined;
}
/** The short-locale of a user */
type ShortLocale = string;
}
export = locale;
- Last updated: Tue, 07 Nov 2023 03:09:37 GMT
- Dependencies: @types/express, @types/express-serve-static-core
These definitions were written by Piotr Błażejewicz.