Socket
Socket
Sign inDemoInstall

@formatjs/intl-displaynames

Package Overview
Dependencies
Maintainers
3
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl-displaynames

Polyfill for: https://tc39.es/proposal-intl-displaynames


Version published
Weekly downloads
1.4M
increased by3.02%
Maintainers
3
Weekly downloads
 
Created

What is @formatjs/intl-displaynames?

@formatjs/intl-displaynames is a JavaScript library that provides a way to display names of various international entities such as languages, regions, scripts, and currencies in a localized manner. It leverages the Internationalization API to format these names according to the specified locale.

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

Display Language Names

This feature allows you to display the name of a language in a localized format. In this example, the name of the French language is displayed in English.

const { DisplayNames } = require('@formatjs/intl-displaynames');
const displayNames = new DisplayNames(['en'], { type: 'language' });
console.log(displayNames.of('fr')); // Output: French

Display Region Names

This feature allows you to display the name of a region in a localized format. In this example, the name of the United States is displayed in English.

const { DisplayNames } = require('@formatjs/intl-displaynames');
const displayNames = new DisplayNames(['en'], { type: 'region' });
console.log(displayNames.of('US')); // Output: United States

Display Script Names

This feature allows you to display the name of a script in a localized format. In this example, the name of the Latin script is displayed in English.

const { DisplayNames } = require('@formatjs/intl-displaynames');
const displayNames = new DisplayNames(['en'], { type: 'script' });
console.log(displayNames.of('Latn')); // Output: Latin

Display Currency Names

This feature allows you to display the name of a currency in a localized format. In this example, the name of the US Dollar is displayed in English.

const { DisplayNames } = require('@formatjs/intl-displaynames');
const displayNames = new DisplayNames(['en'], { type: 'currency' });
console.log(displayNames.of('USD')); // Output: US Dollar

Other packages similar to @formatjs/intl-displaynames

Keywords

FAQs

Package last updated on 19 May 2024

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