Reload page or dynamically update content after switching language?

940 Views Asked by At

I'm struggling with design of i18n handling, what should we do after a user has changed the language?

  1. Reload the browser with the selected language
  2. Dynamically update the labels and other translatable things without a refresh

Any suggestion on this?

BTW, keep in mind we build a SPA project, the project size won't be as large as an E-commerce portal

1

There are 1 best solutions below

0
Jay Patel On

Possible solutions with i18n (you will need reload page when language is changed, angualr i18n can't update displayed data in runtime):

  1. Use some subdomain like en.domain.com & fr.domain.com and when language changed navigate user
  2. Using localStorage (or other storage) for storing selected language
  3. Use some prefix (like in first) domain.com/en OR domain.com/fr

With using ngx-translate u can saw actually language when it changed (runtime updated).

Thanks!