Socket
Socket
Sign inDemoInstall

@formatjs/intl-localematcher

Package Overview
Dependencies
1
Maintainers
3
Versions
43
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @formatjs/intl-localematcher

Intl.LocaleMatcher ponyfill


Version published
Weekly downloads
4.3M
increased by2.28%
Maintainers
3
Install size
867 kB
Created
Weekly downloads
 

Package description

What is @formatjs/intl-localematcher?

The @formatjs/intl-localematcher package is designed to help with locale matching based on the Best Fit Matcher algorithm as specified by the ECMAScript Internationalization API. It allows developers to determine the best available locale for their application based on a list of desired locales and a list of supported locales. This can be particularly useful in internationalization (i18n) efforts where applications need to gracefully handle multiple languages and regional differences.

What are @formatjs/intl-localematcher's main functionalities?

Locale Matching

This feature allows you to match a list of desired locales against a list of supported locales to find the best match. It uses the Best Fit Matcher algorithm to determine the most appropriate locale for the user.

"use strict";
const {getCanonicalLocales, match} = require('@formatjs/intl-localematcher');

const supportedLocales = ['en-US', 'fr-FR', 'es-ES'];
const desiredLocales = ['en-GB', 'en'];

const bestMatch = match(desiredLocales, supportedLocales);
console.log(bestMatch); // 'en-US'

Other packages similar to @formatjs/intl-localematcher

Readme

Source

Intl LocaleMatcher

We've migrated the docs to https://formatjs.io/docs/polyfills/intl-localematcher.

Keywords

FAQs

Last updated on 16 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc