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

feat: React-agnostic core #137

Merged
merged 13 commits into from
Oct 18, 2022
Merged

feat: React-agnostic core #137

merged 13 commits into from
Oct 18, 2022

Conversation

amannn
Copy link
Owner

@amannn amannn commented Oct 14, 2022

Fixes #47
Fixes #134

This extracts the core library to be agnostic of React to allow usage e.g. in API routes., please refer to the new section in the docs to learn more. I've updated the advanced example in this branch to demonstrate the usage in API routes including locale negotiation that I'd recommend.

The core offers the same capabilities that were previously exposed via useTranslations and useIntl, with the minor difference that rich text formatting operates with strings only, to avoid usage of React in the core (many thanks to @dbrxnds for the feedback and discussion here!). Strict typing for messages is enabled for the new APIs as well.

Feedback about the API, the docs and generally if everything works as expected would be greatly appreciated!

Preview

npm install [email protected]

@amannn amannn self-assigned this Oct 14, 2022
@vercel
Copy link

vercel bot commented Oct 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
next-intl ✅ Ready (Inspect) Visit Preview Oct 18, 2022 at 7:50AM (UTC)

@amannn amannn marked this pull request as ready for review October 18, 2022 07:28
@amannn amannn merged commit 91f7489 into main Oct 18, 2022
@amannn amannn deleted the feat/47-backend-usage branch October 18, 2022 12:19
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.

Official examples have type errors in _app.tsx Enable usage in backend code
1 participant