Socket
Socket
Sign inDemoInstall

@formatjs/intl-locale

Package Overview
Dependencies
Maintainers
3
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl-locale

Intl.Locale polyfill


Version published
Weekly downloads
363K
increased by0.38%
Maintainers
3
Weekly downloads
 
Created

What is @formatjs/intl-locale?

@formatjs/intl-locale is a JavaScript library that provides utilities for working with locale identifiers. It is part of the FormatJS suite, which is designed to help with internationalization in JavaScript applications. This package allows you to parse, manipulate, and format locale identifiers according to the Unicode CLDR (Common Locale Data Repository) specification.

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

Parsing Locale Identifiers

This feature allows you to parse a locale identifier string into an object that contains its components, such as language, script, and region.

const { parse } = require('@formatjs/intl-locale');
const locale = parse('en-US');
console.log(locale);

Formatting Locale Identifiers

This feature allows you to format a locale object back into a string. This is useful for ensuring that locale identifiers are consistently formatted.

const { parse, format } = require('@formatjs/intl-locale');
const locale = parse('en-US');
const formattedLocale = format(locale);
console.log(formattedLocale);

Locale Comparison

This feature allows you to compare two locale objects to see if they are equivalent. This can be useful for determining if two different locale identifiers refer to the same locale.

const { parse, isEqual } = require('@formatjs/intl-locale');
const locale1 = parse('en-US');
const locale2 = parse('en-GB');
console.log(isEqual(locale1, locale2));

Other packages similar to @formatjs/intl-locale

Keywords

FAQs

Package last updated on 26 Mar 2022

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