Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formatjs/intl-localematcher

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl-localematcher

Intl.LocaleMatcher ponyfill

  • 0.2.18
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.9M
decreased by-2.32%
Maintainers
3
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 24 Jul 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc