# @types/express-simple-locale

> TypeScript definitions for express-simple-locale

Latest version **0.3.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/express-simple-locale
pnpm add @types/express-simple-locale
yarn add @types/express-simple-locale
bun add @types/express-simple-locale
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.3.4 |
| Published | 2023-11-07 |
| First published | 2020-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51446 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/express-simple-locale
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-simple-locale
- npm.io page: https://npm.io/package/@types/express-simple-locale

## Dependencies (2)

- [@types/express](https://npm.io/package/@types/express.md) *
- [@types/express-serve-static-core](https://npm.io/package/@types/express-serve-static-core.md) *

## Recent versions

- 0.3.4 (latest) — 2023-11-07
- 0.3.1 (ts3.6) — 2021-07-08
- 0.3.0 (ts3.1) — 2020-08-27
- 0.3.3 — 2023-10-18
- 0.3.2 — 2023-09-23

## README

# Installation
> `npm install --save @types/express-simple-locale`

# Summary
This package contains type definitions for express-simple-locale (https://github.com/n26/express-simple-locale#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-simple-locale.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-simple-locale/index.d.ts)
````ts
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;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 03:09:37 GMT
 * Dependencies: [@types/express](https://npmjs.com/package/@types/express), [@types/express-serve-static-core](https://npmjs.com/package/@types/express-serve-static-core)

# Credits
These definitions were written by [Piotr Błażejewicz](https://github.com/peterblazejewicz).

---
_Source: https://npm.io/package/@types/express-simple-locale · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
