0

I have set up translation on a custom picklist field as shown:

Picklist Translations

The language selected for the Picklist Labels is French, and my User's Language is set to French.

According to my understanding, this code below should output the labels in French, but all I get is English:

Schema.DescribeFieldResult fieldResult = 
Absence__c.Reason__c.getDescribe();
List<Schema.PicklistEntry> entries = fieldResult.getPicklistValues();
System.debug(UserInfo.getLanguage());
for (Schema.PicklistEntry entry : entries) {
   System.debug(entry.getLabel());
}

Expected Result is:

fr 
Congé prévu
Congé non prévu
Maladie

Actual Result is:

fr
Planned Vacation
Unplanned Vacation
Sickness
...

UserInfo.getLanguage() returns fr as expected, but why are the labels all in English still?

3
  • 1
    I tried your code and it worked fine - I used a custom picklist field on Opportunity. getLabel() showed the French translation and getValue() showed English. Perhaps you ran your code in a different sandbox from where you made the translation entries? I can't think of any other reason this would occur. Nov 27 at 18:25
  • Turns out that there are about 1000 different things in setup which have to be configured exactly right for it to work.
    – NickJ
    2 days ago
  • Out of curiosity, what settings did you make to finally get it working? 2 days ago

0

You must log in to answer this question.

Browse other questions tagged .