Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@lingui/macro
Advanced tools
@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.
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'
});
react-intl is a popular library for internationalization in React applications. It provides components and an API to format dates, numbers, and strings, and to handle pluralization and translations. Compared to @lingui/macro, react-intl is more component-based and may require more boilerplate code.
i18next is a full-featured i18n framework for JavaScript. It supports translation, pluralization, and formatting, and can be used with various front-end frameworks including React. i18next is more flexible and can be used in a wider range of environments compared to @lingui/macro, which is more tightly integrated with LinguiJS.
formatjs is a set of libraries for internationalization in JavaScript, including react-intl. It provides low-level APIs for formatting dates, numbers, and strings, and for handling pluralization and translations. formatjs offers more granular control over i18n tasks compared to @lingui/macro.
Babel Macros which transforms tagged template literals and JSX components to ICU MessageFormat.
@lingui/macro
is part of LinguiJS. See the documentation for all information, tutorials and examples.
See the reference documentation.
5.0.0 (2024-11-28)
We are pleased to announce the release of Lingui 5.0! This release is a major milestone for the project and includes a number of new features, improvements and bug fixes.
Check out the links below for more details:
FAQs
Macro for generating messages in ICU MessageFormat syntax
The npm package @lingui/macro receives a total of 125,679 weekly downloads. As such, @lingui/macro popularity was classified as popular.
We found that @lingui/macro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.