2

We have a lightning component that displays State & Country Picklists. The component is on a Community builder page with a French language community.

Note: The default language for the organization is English.

The lightning components calls into an Apex controller that executes the following

System.debug(UserInfo.getLanguage());
Schema.SObjectType objType = Schema.getGlobalDescribe().get('Contact');
Schema.DescribeSObjectResult describeResult = objType.getDescribe();
Schema.DescribeFieldResult contrfieldApiNameInfo = describeResult.fields.getMap().get('MailingCountry').getDescribe();

List<Schema.PicklistEntry> controllingValues = contrfieldApiNameInfo.getPicklistValues();
system.debug(controllingValues);

When this code is executed by a french user within a unit test (using runAs) or as anonymous apex (by a french user) the picklist labels returned are French.

However, when executed by the lightning component within the French language community by a French user (confirmed through the UserInfo call), we get only the English labels.

Any thoughts on avenues to explore would be appreciated.

Thanks,

  • Did you setup the community for french language? – RedDevil May 25 '18 at 6:11
  • Just tried in a non-community way: General Lightning component does show Spanish labels for a Spain user (locale, language set to spanish) and in English for default english user (org default is english). Can you please confirm you are definitely looking at the Label and not the Value of picklist? Also, does the debug log in apex show French or English labels? – Rohit Kunal May 26 '18 at 15:32
  • @RedDevil, Yes the community setup for French (Only). – Mike Ginou May 28 '18 at 13:06
  • @RohitKunal, Yes I'm definitely looking at labels and the debug log shows English labels within the community context. When running the same code in unit tests, the debug log shows French labels. – Mike Ginou May 28 '18 at 13:08
  • @MikeGinou did you get this resolved? – dangt85 Aug 8 '18 at 14:24
1

As helped by Salesforce support, the issue appears to have been due to the use of a locale specific language variant.

The site is Canadian, and French. As such we chose to add fr(CA) as the language available. This language does not provide the translations as specified in the Translation workbench.

Instead, adding French (fr) as the available language DOES allow the translations to be sucessfully retrieved.

  • @dangt85 We did get the issue resolved. I've posted the corresponding answer here. – Mike Ginou Sep 17 '18 at 16:03

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.