You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm learning how next-i18next works. Currently we have a large-ish website, and all pages use the serverSideTranslations like
consttranslations=awaitserverSideTranslations('en',['somenamespace']);// ...return{props: {// other props ...
...translations,},};
That works fine, and will ensure that translations work on server side rendering with getServersideProps and getStaticProps.
On a full page load, this is obviously fine.
When the user does client-side navigation to a page that uses the same namespace, it seems wasteful to me to put the translations into the page props again-
Currently we have a single namespace at around 130KB, and splitting it into smaller chunks while ensuring that all the necessary translation strings are available correctly on all the pages is quite a task, especially since we have a lot of shared components between the pages.
{"_nextI18Next": {"initialI18nStore": {"en": {"somenamespace": {// LOTS OF KEY/VALUES HERE, repeated in all payloads from the server whenever the user client-side navigates (~130KB for us)}},"initialLocale": "en",// config ...}}}
What I'm wondering is, is there a way to prevent putting the translations into the props, but still support the server side rendering?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm learning how next-i18next works. Currently we have a large-ish website, and all pages use the
serverSideTranslations
likeThat works fine, and will ensure that translations work on server side rendering with getServersideProps and getStaticProps.
On a full page load, this is obviously fine.
When the user does client-side navigation to a page that uses the same namespace, it seems wasteful to me to put the translations into the page props again-
Currently we have a single namespace at around 130KB, and splitting it into smaller chunks while ensuring that all the necessary translation strings are available correctly on all the pages is quite a task, especially since we have a lot of shared components between the pages.
What I'm wondering is, is there a way to prevent putting the translations into the props, but still support the server side rendering?
Beta Was this translation helpful? Give feedback.
All reactions