Socket
Book a DemoInstallSign in
Socket

@formatjs/intl-localematcher

Package Overview
Dependencies
Maintainers
3
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl-localematcher

Intl.LocaleMatcher ponyfill

latest
Source
npmnpm
Version
0.6.1
Version published
Weekly downloads
8.4M
-4.63%
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

ecma402

FAQs

Package last updated on 23 Mar 2025

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