Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
@formatjs/intl-localematcher
Advanced tools
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.
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'
The 'locale' package provides similar functionalities for locale detection and negotiation. It can parse, normalize, and match locales using different strategies. Compared to @formatjs/intl-localematcher, 'locale' offers a broader set of features for handling locales but might not specifically implement the Best Fit Matcher algorithm as defined by ECMAScript.
This package is designed to parse the Accept-Language header from an HTTP request and match it against a list of supported languages. While it serves a similar purpose in determining the best language for the user, it is more focused on the context of HTTP requests and does not directly implement the ECMAScript Internationalization API's Best Fit Matcher algorithm.
We've migrated the docs to https://formatjs.io/docs/polyfills/intl-localematcher.
FAQs
Intl.LocaleMatcher ponyfill
The npm package @formatjs/intl-localematcher receives a total of 3,907,764 weekly downloads. As such, @formatjs/intl-localematcher popularity was classified as popular.
We found that @formatjs/intl-localematcher demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
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.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.