I have a Community site. My LWC Component is added into a Visualforce Page using Aura Application and I have added that VF Page to Community. For all the Text in my LWC Component I have created some Custom Labels to Change the Language of Text.

Site is loaded and All the text is in English Default. I have Created a Picklist of Languages and I want to change language of text on the basis of picklist value. if I change picklist value to another language then all the text should be changed.

1 Answer 1


Create a object of object of language to its different text in JS. Use getter to get the text based on language.

Object Example language = {'English':{'headerText':'Welcome','Footer':'Thankyou'},'Spanish':{'headerText':'Welcome in Spanish','Footer':'Thankyou in Spanish'}}

On change of language update languageSelected Variable. Use getter to dynamically render text in html. Ex-

   get headerText(){
       if(language == 'Engish'){
         return language.languageSelected.headerText;
       }else if(language == 'Spanish'){
         return language.languageSelected.headerText;

HTML code:


Hope you get some idea

  • I don't want to have all the data into JS. what I want is, all the text and its translation should be in custom labels not in JS. When my LWC component was on the Community then i have to change the URL From ("demoUrl.com") to ("demoUrl.com?language=fr_CH") and all the text was translated into french automatically. Now i have added the LWC Component on VF page using Aura Application and Put that VF Page on Community. Now Change the URL by adding language parameter is not changing the text language into the LWC. Commented Oct 27, 2022 at 8:31
  • Earlier LWC text language was depending on URL's Language Parameter but now LWC is not depending on URL. Commented Oct 27, 2022 at 8:31
  • @VipinSharma did you get solution for this?
    – Rachit
    Commented May 17, 2023 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .