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

@lingui/macro

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lingui/macro

Macro for generating messages in ICU MessageFormat syntax

  • 3.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
146K
decreased by-6.9%
Maintainers
1
Weekly downloads
 
Created

What is @lingui/macro?

@lingui/macro is a package that provides macros for internationalization (i18n) in JavaScript and React applications. It allows developers to mark strings for translation and handle pluralization, among other i18n tasks, in a way that integrates seamlessly with the LinguiJS framework.

What are @lingui/macro's main functionalities?

Translation

The `t` macro is used to mark strings for translation. This allows the string to be extracted and translated into different languages.

import { t } from '@lingui/macro';

const message = t`Hello, World!`;

Pluralization

The `plural` macro handles pluralization based on a count. It allows you to define different strings for singular and plural forms.

import { plural } from '@lingui/macro';

const message = plural(count, {
  one: '# book',
  other: '# books'
});

Select

The `select` macro is used for gender-based or other categorical selections. It allows you to define different strings based on the value of a variable.

import { select } from '@lingui/macro';

const message = select(gender, {
  male: 'He is a developer.',
  female: 'She is a developer.',
  other: 'They are a developer.'
});

Date and Time Formatting

The `date` macro formats dates according to the specified options. This is useful for displaying dates in a localized format.

import { date } from '@lingui/macro';

const message = date(new Date(), {
  year: 'numeric',
  month: 'long',
  day: 'numeric'
});

Other packages similar to @lingui/macro

Keywords

FAQs

Package last updated on 22 Nov 2020

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