@preply/babel-plugin-react-intl-auto-id
v1.1.3-sergii-test
Published
Generate react-intl message IDs from their defaultMessage and description
Downloads
4,701
Keywords
Readme
Generage Your react-intl Message IDs
Have your id
generated for you! Just code:
<FormattedMessage
defaultMessage={\`Hello {name}, you have {unreadCount, plural,
=0 {no new messages}
one {# new message}
other {# new messages}
}\`}
/>
And have your id
generated by serializing defaultMessage
and description
Supported Syntax
FormattedMessage
:
<FormattedMessage defaultMessage="Hey there!" />
FormattedHTMLMessage
:
<FormattedHTMLMessage defaultMessage="Hey there!" />
TranslatedText
<TranslatedText defaultMessage="Hey there!" />
defineMessages
defineMessages({ placeholder: { defaultMessage: 'Type smth!' } })
- Basic syntax:
<FormattedMessage defaultMessage="Hey there!" />
- Multi-line strings:
<FormattedMessage
defaultMessage="Hey
there! This is
quite a long message
which we might format differently"
/>
- Back-quoted strings:
<FormattedMessage
defaultMessage={\`Hello {name}, you have {unreadCount, plural,
=0 {no new messages}
one {# new message}
other {# new messages}
}\`}
/>
Note: line breaks are eliminated, so the id
doesn't not change after a multi-line string gets reformatted.
Dev
Publishing
npm publish --access public
. No CI 'cause it'll barely ever change.