5

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,

5
  • Did you setup the community for french language?
    – RedDevil
    Commented May 25, 2018 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?
    – markgarg
    Commented May 26, 2018 at 15:32
  • @RedDevil, Yes the community setup for French (Only).
    – Mike Ginou
    Commented May 28, 2018 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
    Commented May 28, 2018 at 13:08
  • @MikeGinou did you get this resolved?
    – dangt85
    Commented Aug 8, 2018 at 14:24

1 Answer 1

2

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.

2
  • @dangt85 We did get the issue resolved. I've posted the corresponding answer here.
    – Mike Ginou
    Commented Sep 17, 2018 at 16:03
  • did you manage to solve this? Can you relink the solution?
    – Zame
    Commented Jul 29, 2020 at 4:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .