Skip to content
Discussion options

You must be logged in to vote

Okay, so for anyone who needs this: because we are in SSR, we need to render localized messages somehow both on server and client
On server, we load locale chunks and just translate (this is what gets pre-rendered)
On client, because i18n object can't be serialized to client directly, we pass locale messages via pageContext, and activate them on client. During client-side navigation, onBeforeRender is called, fetches only the new language's chunk, and it is being applied.

The main thing: as i18n object is global, you must disable parallel pre-rendering!


prerender: {
    enable: true,
    parallel: false,
  },

The alternative solution to this is to get a new i18n instance each time, but …

Replies: 2 comments 29 replies

Comment options

You must be logged in to vote
26 replies
@brillout
Comment options

@MrNaif2018
Comment options

@MrNaif2018
Comment options

@MrNaif2018
Comment options

Answer selected by MrNaif2018
@brillout
Comment options

@MrNaif2018
Comment options

@brillout
Comment options

@brillout
Comment options

Comment options

You must be logged in to vote
3 replies
@MrNaif2018
Comment options

@brillout
Comment options

@Ercilan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants