Performance: Domain routing for locales
MEDIUM IMPACT
This affects the initial page load speed by determining which locale content is served based on the domain, impacting server response and client rendering.
export default { i18n: { locales: ['en', 'fr'], defaultLocale: 'en', domains: [ { domain: 'example.com', defaultLocale: 'en' }, { domain: 'example.fr', defaultLocale: 'fr' } ] } } // Domain routing for locales
export default { i18n: { locales: ['en', 'fr'], defaultLocale: 'en', localeDetection: true } } // No domain routing, locale chosen by browser or path
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Client-side locale detection with redirects | No extra DOM nodes | Multiple reflows due to content shifts | Higher paint cost from layout shifts | [X] Bad |
| Server-side domain routing for locales | No extra DOM nodes | Single reflow with stable layout | Lower paint cost with stable content | [OK] Good |