Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@intlify/message-compiler

Package Overview
Dependencies
Maintainers
2
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intlify/message-compiler

@intlify/message-compiler

  • 9.3.0-beta.14-77e850b
  • edge
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by0.1%
Maintainers
2
Weekly downloads
 
Created

What is @intlify/message-compiler?

@intlify/message-compiler is a powerful tool for compiling and formatting messages in internationalized applications. It is part of the Intlify project, which aims to provide comprehensive internationalization (i18n) solutions for JavaScript applications, particularly those built with Vue.js.

What are @intlify/message-compiler's main functionalities?

Message Compilation

This feature allows you to compile a message string with placeholders into a function that can be executed with a context object to produce a formatted message.

const { compile } = require('@intlify/message-compiler');
const msg = 'Hello, {name}!';
const compiled = compile(msg);
console.log(compiled({ name: 'World' })); // Output: Hello, World!

Custom Formatting

This feature supports custom formatting for numbers, dates, and other data types using the ICU MessageFormat syntax.

const { compile } = require('@intlify/message-compiler');
const msg = 'The price is {price, number, currency}.';
const compiled = compile(msg);
console.log(compiled({ price: 1234.56 })); // Output: The price is $1,234.56.

Pluralization

This feature allows you to handle pluralization in messages, making it easy to provide correct grammar for different quantities.

const { compile } = require('@intlify/message-compiler');
const msg = '{count, plural, one {# item} other {# items}}';
const compiled = compile(msg);
console.log(compiled({ count: 1 })); // Output: 1 item
console.log(compiled({ count: 5 })); // Output: 5 items

Other packages similar to @intlify/message-compiler

Keywords

FAQs

Package last updated on 10 Jan 2023

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