Skip to content

Removed React context mention in the documentation - #2841

Merged
djhi merged 4 commits into
marmelab:masterfrom
maoueh:fix/translation-context-docs
Jan 31, 2019
Merged

djhi merged 4 commits into
marmelab:masterfrom
maoueh:fix/translation-context-docs

Conversation

@maoueh

@maoueh maoueh commented Jan 31, 2019

Copy link
Copy Markdown
Contributor

In the section Translate your own components

@maoueh

maoueh commented Jan 31, 2019

Copy link
Copy Markdown
Contributor Author

Replaces #2829

@djhi djhi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/The react-admin package/React-admin/

@djhi djhi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/of wrapped component/of the wrapped component/

Comment thread docs/Translation.md Outdated
```

However, using the context makes components harder to test. That's why react-admin provides a `translate` Higher-Order Component, which simply passes the `translate` function from context to props:
The react-admin package provides a `translate` Higher-Order Component, which simply passes the `translate` function to props of wrapped component:

@djhi djhi Jan 31, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The react-admin package provides a `translate` Higher-Order Component, which simply passes the `translate` function to props of wrapped component:
React-admin provides a `translate` Higher-Order Component, which simply injects the `translate` function to the wrapped component:

@djhi djhi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR 👍

Comment thread docs/Translation.md Outdated
# Translation

The react-admin interface uses English as the default language. But it also supports any other language, thanks to the [polyglot.js](http://airbnb.io/polyglot.js/) library.
React-admin interface uses English as the default language. But it also supports any other language, thanks to the [polyglot.js](http://airbnb.io/polyglot.js/) library.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should have kept the The as we are refering to the interface 😉

Comment thread docs/Translation.md Outdated
```

However, using the context makes components harder to test. That's why react-admin provides a `translate` Higher-Order Component, which simply passes the `translate` function from context to props:
React-admin package provides a `translate` Higher-Order Component, which simply passes the `translate` function to props of the wrapped component:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last one I think 😄

s/to props of/as a prop to/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went really too quick :)

@djhi djhi added this to the v2.6.4 milestone Jan 31, 2019
@djhi
djhi merged commit 56d7439 into marmelab:master Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants