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

Message splitting #1615

Open
3 tasks
jefer94 opened this issue Dec 17, 2024 · 1 comment
Open
3 tasks

Message splitting #1615

jefer94 opened this issue Dec 17, 2024 · 1 comment
Labels
enhancement New feature or request unconfirmed Needs triage.

Comments

@jefer94
Copy link

jefer94 commented Dec 17, 2024

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

The [lang].json could grow significantly, usually, a section is unused in the major part of the page, when Next split the code it found that [lang].json is a single entity and put the whole [lang].json in a chunk, when the user does its first load, they should get a lot of translations that they don't want to use yet

Describe the solution you'd like

I am not sure how useTranslation works right now, so, I will suppose the behavior and then these steps should be discarded

for const t = useTranslations("notFound");

  • t('x') could be splitted into [lang].global.json virtually
  • t('[category].x') could be splitted into [lang].[category].json virtually
  • t('[category].[subcategory].x') could be splitted into [lang].[category].[subcategory].json virtually

Previously chunk generated

  • [lang].json

Proposed chunks generated

  • [lang].json
  • [lang].[category].json
  • [lang].[category].[subcategory].json

Describe alternatives you've considered

I think there is no alternative

@jefer94 jefer94 added enhancement New feature or request unconfirmed Needs triage. labels Dec 17, 2024
@amannn
Copy link
Owner

amannn commented Dec 18, 2024

This section goes in depth on this use case: Using internationalization in Client Components.

The long-term goal is: #1

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