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

Lazy-load intl-messageformat #1083

Closed
EliasVal opened this issue May 22, 2024 · 3 comments
Closed

Lazy-load intl-messageformat #1083

EliasVal opened this issue May 22, 2024 · 3 comments
Labels
enhancement New feature or request unconfirmed Needs triage.

Comments

@EliasVal
Copy link

Is your feature request related to a problem? Please describe.

While building my Next.js app, I noticed that intl-messageformat is taking up quite a bit of space.

page.tsx with useTranslations:
image

page.tsx without useTranslations:
image

Bundle analyzer result with useTranslaions:
image

Describe the solution you'd like

Either have the option to somehow opt-out of formatting, or lazy-load it on the client.

Describe alternatives you've considered

Haven't looked into any other solutions.

@EliasVal EliasVal added enhancement New feature or request unconfirmed Needs triage. labels May 22, 2024
@amannn
Copy link
Owner

amannn commented May 22, 2024

Thanks you for the question! It's indeed planned to get rid of intl-messageformat on the client side, please see #962.

For the time being, staying with translations within Server Components can be an alternative to avoid loading int-messageformat on the client side.

Hope this helps!

@amannn amannn closed this as completed May 22, 2024
@EliasVal
Copy link
Author

@amannn Thanks for the quick reply and the amazing work on the package! What's the progress on #705 ? (And as for your comment on an issue I posted a while back, the new option to opt out of the i18n routing works flawlessly!)

@amannn
Copy link
Owner

amannn commented May 22, 2024

You can follow #705 for the latest progress, but it's still a bit early. There are currently a few other priorities, but I'd like to get back to that PR as soon as I find the time. I can't really give an estimate currently, but the feature is rather months away I guess.

Since it's quite a change, there might be an opt-in experimental flag in the future to get feedback from early adopters. Might take a bit for the feature to stabilize, also icu-to-json that's mentioned in the PR is experimental at this point.

If you subscribe to the PR or the issue, I can keep you in the loop!

And as for your comment on an issue I posted a while back, the new option to opt out of the i18n routing works flawlessly!

Cool, that's nice to hear! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants