Next.js Discord

Discord Forum

Does splitting i18n dictionaries by page section improve initial load performance in Next.js?

Unanswered
Polar bear posted this in #help-forum
Open in Discord
Avatar
Polar bearOP
I’m implementing i18n in a Next.js project using next-intl and am considering between two ways of organizing translation dictionaries. Assuming there are 3 pages: Homepage, Contact, Dashboard.

Method 1 - Split by page section and then by language:
└── dictionaries/
    ├── Homepage/
    │   ├── en.json
    │   └── cn.json
    ├── Contact/
    │   ├── en.json
    │   └── cn.json
    └── Dashboard/
        ├── en.json
        └── cn.json

Method 2 - Single file per language:
└── dictionaries/
    ├── en.json
    └── cn.json

// en.json and cn.json
{
  "Homepage": {...},
  "Contact": {...},
  "Dashboard": {...}
}


The next-intl official docs and many tutorials follow the method 2 but does it give more overhead on initial load than the method 1 since all the translations of all pages would be loaded at once?

0 Replies