# lookup-closest-locale

> Lookup the closest locale from among object keys

Latest version **6.2.0** (published 2018-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install lookup-closest-locale
pnpm add lookup-closest-locale
yarn add lookup-closest-locale
bun add lookup-closest-locale
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.2.0 |
| Published | 2018-09-12 |
| First published | 2015-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 204 |
| Author | Andy VanWagoner |
| Maintainers | thetalecrafter |
| Keywords | i18n, lookup, BCP47, language tag |

## Links

- npm: https://www.npmjs.com/package/lookup-closest-locale
- Repository: https://github.com/format-message/format-message
- Homepage: https://github.com/format-message/format-message/tree/master/packages/lookup-closest-locale
- Issues: https://github.com/format-message/format-message/issues
- npm.io page: https://npm.io/package/lookup-closest-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.2.0 (latest) — 2018-09-12
- 6.0.0-alpha.2 (next) — 2018-04-18
- 6.1.0 — 2018-08-30
- 6.0.4 — 2018-06-05
- 6.0.3 — 2018-04-27
- 6.0.0 — 2018-04-19
- 6.0.0-alpha.1 — 2018-04-17
- 6.0.0-alpha.0 — 2018-04-16
- 5.1.0 — 2016-12-28
- 5.0.0 — 2016-09-27
- 5.0.0-beta.10 — 2016-09-26
- 5.0.0-beta.9 — 2016-09-26
- 5.0.0-beta.8 — 2016-09-26
- 4.0.0 — 2015-11-15

## README

# ![format-message][logo]
> Internationalize text, numbers, and dates using ICU Message Format.

[![npm Version][npm-image]][npm]
[![Build Status][build-image]][build]


[![JS Standard Style][style-image]][style]
[![MIT License][license-image]][LICENSE]

# LOOKING FOR MAINTAINERS

The current maintainers are looking for someone to take over the maintaince of this package.  If you are interested please reach out to [vanwagonet](https://github.com/vanwagonet)

## Internationalization Made Easy

Start simple. Wrap any user-facing message with `formatMessage()`. Don't forget to import/require format-message.

```js
var formatMessage = require('format-message');
// ...
formatMessage('My Account Preferences')
```

Don't concatenate message pieces, use placeholders instead.

```js
formatMessage('Hello, { name }!', { name: user.name })
```

You can even pick plural and gender forms with placeholders.

```js
formatMessage(`{
  gender, select,
    male {His inbox}
  female {Her inbox}
   other {Their inbox}
 }`, { gender: user.gender })

 formatMessage(`{
   count, plural,
      =0 {No unread messages}
     one {# unread message}
   other {# unread messages}
 }`, { count: messages.unreadCount })
```

Need to provide extra information to translators? Add a message description.
Need 2 translations to the same English message? Add a message id.

```js
formatMessage({
  id: 'update_action_button',
  default: 'Update',
  description: 'Text displayed on the update resource button to trigger the update process'
})
formatMessage({
  id: 'update_label',
  default: 'Update',
  description: 'Label on each item that is an update to another item'
})
```

Extract all of the messages you've used in your source code.

```bash
$ npm i format-message-cli
$ format-message extract "src/**/*.js" > ./locales/en/messages.json
```

Check that the translators preserved placeholders and proper message formatting.

```bash
$ format-message lint -t ./locales/index.js "src/**/*.js"
```

Use the translations at runtime.

```js
formatMessage.setup({
  generateId: require('format-message-generate-id/underscored_crc32'),
  translations: require('./locales'),
  locale: 'pt'
})
```

Make a locale-specific build.

```bash
$ format-message transform --inline --locale pt "src/**/*.js" > bundle.pt.js
```


### Need more details?

Check out the many ways you can use format-message in your project:

* [message-format](https://github.com/format-message/format-message/tree/master/packages/message-format)
* [format-message](https://github.com/format-message/format-message/tree/master/packages/format-message)
* [format-message-cli](https://github.com/format-message/format-message/tree/master/packages/format-message-cli)
* [eslint-plugin-format-message](https://github.com/format-message/format-message/tree/master/packages/eslint-plugin-format-message)
* [babel-plugin-extract-format-message](https://github.com/format-message/format-message/tree/master/packages/babel-plugin-extract-format-message)
* [babel-plugin-transform-format-message](https://github.com/format-message/format-message/tree/master/packages/babel-plugin-transform-format-message)


License
-------

This software is free to use under the MIT license. See the [LICENSE-MIT file][LICENSE] for license text and copyright information.


[logo]: https://format-message.github.io/format-message/logo.svg
[npm]: https://www.npmjs.org/package/format-message
[npm-image]: https://img.shields.io/npm/v/format-message.svg
[deps]: https://david-dm.org/format-message/format-message
[deps-image]: https://img.shields.io/david/format-message/format-message.svg
[dev-deps]: https://david-dm.org/format-message/format-message#info=devDependencies
[dev-deps-image]: https://img.shields.io/david/dev/format-message/format-message.svg
[build]: https://travis-ci.org/format-message/format-message
[build-image]: https://img.shields.io/travis/format-message/format-message.svg
[style]: https://github.com/feross/standard
[style-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[license-image]: https://img.shields.io/npm/l/format-message.svg
[message-format]: https://github.com/format-message/message-format
[LICENSE]: https://github.com/format-message/format-message/blob/master/LICENSE-MIT

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