lingui-macro
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

License Version Downloads Babel Macro

lingui-macro

Babel Macros which transforms tagged template literals and JSX components to ICU MessageFormat.

lingui-macro is modified version of @lingui/macro in which defineMessage macro returns string instead of MessageDescriptor. (Migration purpose)

Installation

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

Usage

See the reference documentation.

import { setupI18n } from "@lingui/core"
import { defineMessage } from "@lingui/macro"

const message = defineMessage`Hello, my name is {name}`;

/**
 * line above is transformed using babel-plugin-macros to string instead of MessageDescriptor
 * 
 * @lingui/macro:
 * const message = {id:"msgId", message: "Hello, my name is {name}"};
 * 
 * lingui-macro:
 * const message = `Hello, my name is {name}`;
*/

const i18n = setupI18n();

const translatedMessage = i18n._(message, {name: "Steve"})

License

MIT

Package Sidebar

Install

npm i lingui-macro

Weekly Downloads

3

Version

1.2.2

License

MIT

Unpacked Size

76.1 kB

Total Files

9

Last publish

Collaborators

  • abdul.kissflow