# @lingui/detect-locale

> Detects the user's locale from the URL, a cookie, storage, the browser settings or the HTML lang attribute

Latest version **6.7.0** (published 2026-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lingui/detect-locale
pnpm add @lingui/detect-locale
yarn add @lingui/detect-locale
bun add @lingui/detect-locale
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 6.7.0 |
| Published | 2026-09-11 |
| First published | 2020-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=22.19.0 |
| Dependencies | 0 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5876 |
| Author | Sergio Moreno |
| Maintainers | andrii.bodnar, serhiydmytryshyn |
| Keywords | lingui, locale-detection, i18n, internationalization, accept-language, navigator-language, localization |

## Links

- npm: https://www.npmjs.com/package/@lingui/detect-locale
- Repository: https://github.com/lingui/js-lingui
- Homepage: https://lingui.dev
- Issues: https://github.com/lingui/js-lingui/issues
- npm.io page: https://npm.io/package/@lingui/detect-locale

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 6.7.0 (latest) — 2026-09-11
- 6.0.0-next.4 (next) — 2026-04-17
- 5.1.2 (canary) — 2024-12-16
- 6.6.0 — 2026-07-24
- 6.5.0 — 2026-07-06
- 6.4.0 — 2026-06-16
- 6.3.0 — 2026-06-10
- 6.2.0 — 2026-06-01
- 6.1.0 — 2026-05-21
- 6.0.1 — 2026-04-30
- 6.0.0 — 2026-04-22
- 5.9.5 — 2026-04-06
- 6.0.0-next.3 — 2026-04-02
- 6.0.0-next.2 — 2026-03-27
- 5.9.4 — 2026-03-27
- … 113 more at https://npm.io/package/@lingui/detect-locale/versions

## README

[![License][badge-license]][license]
[![Version][badge-version]][package]
[![Downloads][badge-downloads]][package]

# @lingui/detect-locale

> Detects the user's locale from the URL, a cookie, storage, the browser settings or the HTML lang attribute

`@lingui/detect-locale` is part of [Lingui][documentation]. Lingui is a lightweight, open-source internationalization (i18n) library for JavaScript and TypeScript. It brings compile-time macros and a CLI for message extraction to React, React Native, Vue, SolidJS, Astro, Svelte, and Node.js.

The package has no dependency on the rest of Lingui and works with any i18n library.

## Usage

See the [locale detection reference][reference].

## License

This package is licensed under the [MIT][license] license.

[license]: https://github.com/lingui/js-lingui/blob/main/LICENSE
[documentation]: https://lingui.dev
[reference]: https://lingui.dev/ref/locale-detector
[package]: https://www.npmjs.com/package/@lingui/detect-locale
[badge-downloads]: https://img.shields.io/npm/dw/@lingui/detect-locale.svg
[badge-version]: https://img.shields.io/npm/v/@lingui/detect-locale.svg
[badge-license]: https://img.shields.io/npm/l/@lingui/detect-locale.svg

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