0

I am using Custom labels in my LWC components to enable Spanish translation in community pages. I have a button on the page so that the user can switch between Spanish and English. When clicked, I am setting the selected user language in user record. Right now, I need to reload the entire page after setting the labguage on user record to reflect the translated labels in all components. Is there any other way to do this without reloading the page? I tried sending pubsub to all components in the page to re-render all components after language is set but it is not fetching the translated labels. Any ideas?

7
  • I don't think it's possible to apply translation changes without page refresh. Only thing that comes to my mind is refreshing the page programatically as described here: How to get an LWC component on a record page to refresh when that page is updated Commented Feb 20, 2020 at 16:00
  • Thanks, I dont have any wire calls as I said have only labels which are directly accessible in LWC components without Apex.
    – malu
    Commented Feb 20, 2020 at 17:06
  • So what does "I have a button on the page so that the user can switch between Spanish and English. When clicked [...]" mean here? Is that a standard component or part of a managed package? Commented Feb 20, 2020 at 17:18
  • It is a custom component. You can think like a header component updating language and a different component in the same page (but not child) needs refresh
    – malu
    Commented Feb 20, 2020 at 17:22
  • Ok, I understand. But what I suggested (it's poor solution, I'm aware of that) is just refreshing the whole page after clicking the button and performing language changes (in the same transaction). Commented Feb 20, 2020 at 17:40

0

You must log in to answer this question.