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
Ankit Mishra 191Ankit Mishra 191 

We have an outstanding issue with translating Apex Page Messages to spanish

We are trying to post apex page messages to our custom community Visualforce Pages where we have a Language Dropdown that drops a cookie for the language to change to spanish using custom labels and translation workbench.
Unfortunately it doesn't apply to any page messages sent through apexPages.addMessage() through Apex Controller even if we use a custom label in the class that doesn't get translated.

Any help would be greatly appreciated.

Thanks!
SaketJoshiSaketJoshi
In order to display contents of a VF page into another language, you need to update the "language" attribute in the apex:page tag. Updating it to match the language code for Spanish would solve the problem.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm
Ankit Mishra 191Ankit Mishra 191
Thank you, We're using a custom site template to use the language paramter and other code to be inherited by all other VF pages. Would we need to update each page to make it work? i.e. get the language cooke value in each controller and pass it along per page I mean?
SaketJoshiSaketJoshi
Yes, you need to include this on all the pages.
One more way in which this can be done is by directly making update to the current user's language. But this will not only change the language on your VF page but also for the rest of your Salesforce as well.