Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Table of Contents
absoluteUrltrue
printablefalse

react-intl

  • Since June 2014, most recent release 2.8.0 on Jan 16, 2019
  • Yahoo, 50 contributors, 199 github issues, but as of fall 2018 Yahoo isn't providing a lot of support for it
  • https://github.com/yahoo/react-intl

...

What your code looks like

render() {
const {name, unreadCount} = this.state;

return (
<p>
<FormattedMessage
id="welcome"
defaultMessage={`Hello {name}, you have {unreadCount, number} {unreadCount, plural,
one {message}
other {messages}
}`}
values={{name: <b>{name}</b>, unreadCount}}
/>
</p>
);
}

...

What your code looks like

render() {
const {name, unreadCount} = this.state;

return (
<div>{t('simpleContent')}</div>
<Trans i18nKey="userMessagesUnread" count={unreadCount}>
Hello <strong title={t('nameTitle')}>{{name}}</strong>, you have {{unreadCount}} unread message. <Link to="/msgs">Go to messages</Link>.
</Trans>
);
}

...

What your code looks like

<fbt desc="param example">
Hello, <fbt:param name="name">
{person.getName()}</fbt:param>.
</fbt>

Facebook Notes

Handles dates, numbers, strings, plurals.  Some interesting functionality for pronouns.