Skip to content
connor-baer edited this page Oct 17, 2022 · 12 revisions

Intl.js

Coverage License Contributor Covenant

Format 🔢 numbers and 💱currency values for any locale with the ECMAScript Internationalization API.

Table of contents

Installation

@sumup/intl needs to be installed as a dependency via the Yarn or npm package managers. The npm CLI ships with Node. You can read how to install the Yarn CLI in their documentation. @sumup/intl requires Node v10+.

Depending on your preference, run one of the following:

# With Yarn
$ yarn add @sumup/intl

# With npm
$ npm install @sumup/intl

@sumup/intl wraps the ECMAScript Internationalization API which is supported by all modern browsers (note that formatToParts is not supported by IE11). If you need to support older browsers, you need to include a polyfill for the Intl.NumberFormat API.

Node supports the Intl API since v8, however, it includes only the English localizations up to v12. Node v13 and above support all locales. If you're unable to use Node v13+, you can either include a polyfill for the Intl.NumberFormat API or use a custom Node build.

Usage

All functions exported by @sumup/intl share a similar interface such as the common locales, options, and currency arguments. These are passed on almost unchanged to the Intl.NumberFormat constructor and thus support the same values. If the locales argument is not provided or is undefined, the runtime's default locale is used. Please refer to the MDN documentation for more details.

Code of Conduct

We want to foster an inclusive and friendly community around our Open Source efforts. Like all SumUp Open Source projects, this project follows the Contributor Covenant Code of Conduct. Please, read it and follow it.

If you feel another member of the community violated our CoC or you are experiencing problems participating in our community because of another individual's behavior, please get in touch with our maintainers. We will enforce the CoC.

Maintainers

About SumUp

SumUp logo

SumUp is a mobile point-of-sale provider. It is our mission to make easy and fast card payments a reality across the entire world. You can pay with SumUp in more than 30 countries, already. Our engineers work in Berlin, Cologne, Sofia, and Sāo Paulo. They write code in JavaScript, Swift, Ruby, Go, Java, Erlang, Elixir, and more.

Want to come work with us? Head to our careers page to find out more.