Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update react patterns #980

Merged
merged 8 commits into from
Feb 23, 2021
Merged

Conversation

orangain
Copy link
Contributor

React common patterns is very helpful but its content seems to be a little old. This PR update the content to use useLingui hook instead of I18n render-prop component.

This PR also add link from react tutorial to common i18n patterns as a further reading.

@vercel
Copy link

vercel bot commented Feb 21, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/lingui-js/js-lingui/69TwJtiHzqRVFoKTPWGee1EH4mt4
✅ Preview: https://js-lingui-git-fork-orangain-update-react-patterns-lingui-js.vercel.app

@codecov
Copy link

codecov bot commented Feb 21, 2021

Codecov Report

Merging #980 (0eec517) into main (b006a3c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #980   +/-   ##
=======================================
  Coverage   83.30%   83.30%           
=======================================
  Files          53       53           
  Lines        1605     1605           
  Branches      430      430           
=======================================
  Hits         1337     1337           
  Misses        156      156           
  Partials      112      112           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b006a3c...0eec517. Read the comment docs.

@semoal
Copy link
Contributor

semoal commented Feb 22, 2021

On v3 i18n._(t ) isn't required anymore you can use directly t

@orangain
Copy link
Contributor Author

@semoal Thank you for the comment! I've fixed several examples to use t macro directly. I've also fixed usage of t macro with custom ID.

From my understanding, i18n._ call is still required in the example of lazy translation 0eec517 even in v3. Is it true?

@semoal
Copy link
Contributor

semoal commented Feb 23, 2021

@semoal Thank you for the comment! I've fixed several examples to use t macro directly. I've also fixed usage of t macro with custom ID.

From my understanding, i18n._ call is still required in the example of lazy translation 0eec517 even in v3. Is it true?

Tecnically for lazy translation the best way of doing it, is defineMessage but you can use also the i18n._(), so keep it like that. We have tons of work with the documentation :( so your help is really helpful

@semoal semoal changed the title docs: Update react patterns to use useLingui hook instead of I18n render-prop component docs: Update react patterns Feb 23, 2021
@semoal semoal merged commit 76bc1a7 into lingui:main Feb 23, 2021
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