[SalesForce] How to give custom labels for picklist values in visualforce page

I have visual force page, in that i'l give custom labels for titles, command buttons, except Pick list values…

Here my visual force page…

How to give custom labels for pick list values in visual force???

        <apex:outputText value="{!selectedCountry1}" label="You have selected:"/>
    </apex:pageBlockSection>

    <apex:pageBlockSection title="Custom Picklist Using selectList and selectOptions" collapsible="false">
        <apex:selectList value="{!selectedCountry2}" multiselect="false" size="1">
            <apex:selectOptions value="{!countriesOptions}"/>
        </apex:selectList>

        <apex:outputText value="{!selectedCountry2}" label="You have selected:"/>
    </apex:pageBlockSection>
</apex:pageblock>

Can any one help me……

Best Answer

In your APEX controller code there will be a place where you fill the {!countriesOptions}

There you can use custom labels like you do on the visualforce page.

The first parameter is the value you use in code (so the untranslated value), the second parameter is the label shown to the end-user. So assuming you have a country named 'US' in the picklist, you'd need to create a Custom Label for it, add translations in the required language(s), and use like this:

countriesOptions.add(new SelectOption('US',Label.COUNTRY_US));

That way the label will be shown on the VF Page to each user in their own language, but in the code you will always get the first parameter. E.g. selectedCountry2 will receive the value of the first parameter of the chosen country.