i need to add a new foncitonalty to a visual force page that can trasnlate the entire…
- User
i need to add a new foncitonalty to a visual force page that can trasnlate the entire page based on language selected how i can make it
- Assistant
To add a new functionality to a Visualforce page to translate the entire page based on the language selected, follow these steps:
- User
- Assistant
To add language selector and translation functionality to this Visualforce page, follow the steps below:
-
Create custom labels for all the text to be translated in your Visualforce page.
For example, create custom labels for "Stay in touch," "Please enter your updated contact information," "Firstname," "Name," "Email," "Company," "Current Title," "Phone," "Mobile," "Fax," "Street," "PostalCode," "City," "State/Province," "Country," and any other text elements you want to translate.
-
- User
CONTINUE
- Assistant
Once you have completed the steps mentioned above, your Visualforce page should support language selection and translation. Here's an example of what your updated Visualforce page would look like:
<apex:page Controller="AcuerdoCUR.SiTFormController" title="{!$Label.Stay_In_Touch}" showHeader="false" sidebar="false"> <apex:stylesheet value="{!URLFOR($Resource.AcuerdoCUR__SiT_styles)}"/> <apex:form> <apex:selectList value="{!selectedLanguage}" size="1"> <apex:selectOptions value="{!languages}"/> <apex:actionSupport event="onchange" action="{!changeLanguage}" rerender="translationForm"/> </apex:selectList> </apex:form> <div id="stylized" class="myform"> <apex:form id="translationForm"> ... <apex:outputPanel id="Form" rendered="{!IF(isSend=false,true,false)}"> <h1>{!$Label.Enter_Your_Updated_Contact_Info}</h1> <p> {!$Label.Information_Entered} {!Contact.Owner.Email} </p> <label>{!$Label.Salutation} <span class="small"></span> </label> ... <label>{!$Label.Firstname} <span class="small"></span> </label> ... <label>{!$Label.Name} <span class="small"></span> </label> ... <!-- Repeat for other form fields --> <label>{!$Label.Comment} <span class="small">{!$Label.Extra_Notes} {!Contact.Owner.Name}</span> </label> ... </apex:outputPanel> ... </apex:form> </div> </apex:page>