Salesforce
offer functionality through that we'll be able to create single VF page
which can be translated in several languages based on language/locale
preference of current logged in user. We just need to upload the
translation of all custom fields that you're going to use in VF page . To render the VF page in particular language, use Language
attribute on <apex:page> tag.
Please follow below step to achieve the same.
URL :-Translation Workbench - Salesforce ( Multilingual picklist values )
Step 3) Try to use Salesforce standard way to is to use apex:inputField tag with assigned sobject field. In this case a field will be generated automatically with respect to the current user language.
public with sharing class TranslationWorkbenchController {
public string selectedLang{get;set;}
public List<selectoption> listOfLang {get;set;}
public TranslationWorkbenchController(ApexPages.StandardController controller) {
selectedLang='en';
listOfLang = new List<selectOption>();
listOfLang.add(new selectOption('en','English'));
listOfLang.add(new selectOption('it','Italian'));
listOfLang.add(new selectOption('es','Spanish'));
listOfLang.add(new selectOption('de','German'));
listOfLang.add(new selectOption('fr','French'));
}
}
public string selectedLang{get;set;}
public List<selectoption> listOfLang {get;set;}
public TranslationWorkbenchController(ApexPages.StandardController controller) {
selectedLang='en';
listOfLang = new List<selectOption>();
listOfLang.add(new selectOption('en','English'));
listOfLang.add(new selectOption('it','Italian'));
listOfLang.add(new selectOption('es','Spanish'));
listOfLang.add(new selectOption('de','German'));
listOfLang.add(new selectOption('fr','French'));
}
}
VF Page :-
<apex:page standardcontroller="Account" extensions="TranslationWorkbenchController" language="{!selectedLang}" >
<apex:form >
<apex:selectList value="{!selectedLang}" size="1">
<apex:selectoptions value="{!listOfLang}"/>
<apex:actionsupport event="onchange"/>
</apex:selectlist>
<apex:pageblock >
<apex:pageblocksection >
<apex:inputfield value="{!Account.Name}"/>
<apex:inputfield value="{!Account.Type}"/>
<apex:inputfield value="{!Account.Industry}"/>
<apex:inputfield value="{!Account.BillingCountry}"/>
</apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>
Screen shot :-
English :-
Spanish:-
Thanks
Amit Chaudhary