question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Idea] Allow Text components to accept an intl message

See original GitHub issue

Is your feature request related to a problem? Please describe. At the moment, we usually wrap the intl messages (e.g. FormattedMessage) with the Text components.

<Text.Body>
  <FormattedMessage {...messages.title} />
</Text.Body>

Describe the solution you’d like Allow to pass the intl message directly to the Text component to avoid the wrapping

<Text.Body intlMessage={messages.title} />

// the prop can also be named differently, e.g. `message` but we should probably make it explicit that it relates to react-intl

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tdeekenscommented, Apr 4, 2019

Do we actually have to spead it in? Can’t we

<Text.Body message={messages.title} />

and then the Text.Body internally does the

<div>
  <FormattedMessage message={...props.message} />
</div>

? 😕

0reactions
montezumecommented, Apr 5, 2019

Sounds like a reasonable request 👍

I suggest though that we allow users to (optionally) override how the intl message is rendered, so that they could use different intl libraries.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Components | Format.JS
React Intl has a set of React components that provide a declarative way to setup an i18n context and format dates, numbers, and...
Read more >
React-intl define messages outside of react - Stack Overflow
I have utils.js file. export function categoryIdToCategoryName(categoryId) { let name; switch (categoryId) ...
Read more >
How to insert HTML tag with injectIntl formatMessage using ...
I am using an injectIntl way to use props in the component. Pure String is fine, but it will not work if I...
Read more >
Internationalization With React-Intl | by Blaine Muri - Medium
For those who are not used to internationalization, the idea is to get one single file for all of your original strings, mapped...
Read more >
Internationalization in React Apps using react-intl | by Mahesh
If we are displaying any text, date, number etc to the end user then those components content or messages needs to be wrapped...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found