1

I have a requirement where we created a public form which is a visual force page on a community site exposed to all users. Now this form has lightning components which handle all the form fields, do the validation using LDS with a controller and an apex class to handle data processing logic. Now my requirement is that if the user clicks a button or combo box on the top of the form for english, spanish or chinese, i want all the content on the form to be rendered on the language. Here is what i am thinking as a solution. 1. I will create custom labels which will be in the salesforce org to handle all multiple language content and store all text of the forms as labels. Here is my question. 1. How do i pass a combo box or hyper link value from a visual force page to a lightning component which has the form elements and ultimately get to an apex class where i can read the user input and change the language preference? 2. I know in visual force pages there is a tag for language which i have listed below

I want to set the variable viewstateController.language in the apex class and pass it from visual force page to lightning components. How do i do it?

  1. I understand locales are an option in lightning but how do i override the locale based on user preference?

Has anybody done a multiple language form with lightning component? Buyan

1 Answer 1

1
  1. Use communication between VF page and the lightning component with invoking postMessage() on parent VF page - use this blog: Communicating between Lightning Components and Visualforce Pages - see the Visualforce Page to Lightning Component section to send from VF and to recieve into the lightning component.

  2. For using the $Locale language in lightning you need to change the user's language and refresh your component, you cannot set it in the component itself.

2
  • Thanks for your reply. Do you have any sample code on how to change user language in lightning? Is this in apex or lightning? Commented Aug 17, 2017 at 2:50
  • I do not have code - I have decided not to use this solution for now. The solution should be - change your language from apex, then in lightning on the callback return - refresh your component Commented Aug 17, 2017 at 4:53

You must log in to answer this question.

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