1

How do I check if Translations is enabled in Apex? I have looked around but haven't found anything yet.

For more context: I have created a custom datatable in LWC I have created custom outputfields to display values. When translations are enabled all the values are translated to let's say, French, other than picklist values. This would be fine if I was using the lightning-output-field which I can't for other reasons. Hence I have created a custom apex code that pulls the translated picklist values by doing a describe call.

By default, the page is displayed in English, I want to check if the translation is enabled and only then run custom apex code that pulls the translated picklist values.

Edit: I guess I can check for UserInfo.getLanguage()?

  • What is your use case? Can't you use labels and let the platform determine what it should display? – barrick Aug 1 at 10:27
  • Edited my question and added more context @barrick – d_k Aug 1 at 10:42
  • 1
    Consider using the LWC i18n features along with LWC picklist access. – Phil W Aug 1 at 16:39

Your Answer

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

Browse other questions tagged or ask your own question.