Get started with messageformat CDN

MIT licensed

MessageFormat is a library for defining and formatting messages with placeholders.

Tags:
  • i18n
  • pluralformat
  • icu
  • gettext
  • choiceformat
  • selectformat
  • messageformat
  • internationalization

Stable version

Copied!

How to start using messageformat CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with messageformat CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/messageformat/2.3.0/messageformat.min.js"></script>
</head>
<body>
  <script>
    const format = new Intl.MessageFormat('en-US', {
      pluralities: 'one,other',
    });

    const message = format.resolve(
      'There are {count, plural, =0 {no} =1 {one} other {other, select, =2 {two} other =3 {few} other =0 {many} other } people in the room.',
      { count: 3 }
    );

    console.log(message); // "There are three other people in the room."
  </script>
</body>
</html>
Copied!
Copied!
Copied!

All versions