@lingui/macro

Macro for generating messages in ICU MessageFormat syntax

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@lingui/macro
4.10.011 days ago6 years agoMinified + gzip package size for @lingui/macro in KB

Readme

!Licensebadge-licenselicense !Versionbadge-versionpackage !Downloadsbadge-downloadspackage !Babel Macrobadge-macrolinguijs
@lingui/macro
Babel Macros which transforms tagged template literals and JSX components to ICU MessageFormat.

@lingui/macro is part of LinguiJSlinguijs. See the documentationdocumentation for all information, tutorials and examples.

Installation

npm install --save-dev @lingui/macro
# yarn add --dev @lingui/macro

Usage

See the referencereference documentation.
import { setupI18n } from "@lingui/core"
import { t } from "@lingui/macro"

const i18n = setupI18n()

const message = i18n._(t`Hello, my name is ${name} and today is ${date(now)}`)

// line above is transformed using babel-plugin-macros to this
// const message = i18n._(/*i18n*/{ id: "Hello, my name is {name} and today is {now,date}", values: { name, now }})

License

MITlicense