I have a field picklist with values 1,2,3,4.

Theses values have their labels translated with workbench for example in Spanish uno,dos,tres,cuatro and in English one,two,three,four.

I want to show this in VF page but with the different language that VF page, for example all VF page will be showed in English and I want that only the elements of this picklist appears in the page in Spanish and the rest of the page in English.

Or another example valid would be I want to show the picklist values in the same VF page but in both languages in different lists.

Can someone help me please?.

This is my code to show the picklist elements:

//code apex class controller test
list<SelectOption> labels;
public static List<SelectOption> GetListValueSO(String objName, String objField){
        //Se obtiene los valores del campo
        Map<String,List<String>> objResults = new Map<String,List<String>>();
        Map<String,Schema.SObjectType> objGlobalMap = Schema.getGlobalDescribe();
        Schema.SObjectType pType = objGlobalMap.get('Contact');
        Map<String, Schema.SObjectField> objFieldMap = pType.getDescribe().fields.getMap();
        //Se añaden a lista que devolverá la función 
        for( Schema.PicklistEntry f : objFieldMap.get('mylist').getDescribe().getPicklistValues()){
            labels.add(new SelectOption(f.getValue(), f.getLabel()));

<apex:page controller="test">
    <APEX:PAGEMessages ></APEX:PAGEMessages>

    <apex:form >
        <apex:selectList value="{!labelsel}" size="1">
            <apex:selectOptions value="{!labels}"/>


@rortiz,Apex/vf has a limitation of retrieving custom label depending on the current users language settings only. Find this idea to retrieve for differnt languages

Asa a work around, you could use Metadata API to retrieve all the custom labels, loop over each of them to find out the language and then populate the list with the language of your interest.This can help you with that

|improve this answer|||||

For what it's worth, 2 years too late...

A viable approach could be to split the picklist into a Visualforce Component in which you explicitly declare the language attribute overriding the user's language. You'd have to figure out the right communication patterns to use with the host page but AFAIK this is the only way to force different components of one VF page to render in different languages.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.