function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SUMAN KUMARI 70SUMAN KUMARI 70 

Apex controller to change language on visualforce page

I have a visualforce page on which a link is present. When that link is looking in English, the record is displayed as Spanish and when the link is visible as spanish, the record should be displayed in English.

I have to write this logic in a new apex controller.
And also the page should be displayed in English by default.

Thanks in advance for your help!!
 
AbhishekAbhishek (Salesforce Developers) 
Hi,

In order to render the VF page in a particular language, use the Language attribute on <apex:page> tag. You can also bind these values with the controller variable so that you can render the VF page in different languages.

Try the code as per the below blog,

http://amitsalesforce.blogspot.com/2017/08/language-translation-in-visualforce.html

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.