2

I am calling salesforce API to get compact layouts( /services/data/v46.0/sobjects/Account/describe/compactLayouts/primary ). I get fields label in user's translated language.I am getting same response in workbench and while doing API call from web app.

enter image description here When i call API to get searchlayouts i get different responses in workbench and browser. Reponse i get in workbench is correct. enter image description here

But in Browser we were getting different response. On checking headers we found that we are sending Accept-Language: en-US,en;q=0.9 Header in browser. If i send this header in search layout API call i get english labels.

enter image description here

if i add this header in compact layout API i still get labels in users language. enter image description here

Header Accept-Language: en-US,en;q=0.9 is added by browser by default. But For same header, response of these two apis are different. We are not planning to remove this header as this mightcause an issue for different browser or different language in future.

I was hoping all salesforce apis behaviour should be same and users translated labels should be sent back. Is there anything that i am missing here. Is there any other solution to this issue other than changing Accept-language header.

Manjot Singh
  • 3,508
  • 19
  • 42
  • In our opinion the inconsistency is a bug - open a support case. Does it have to be an API call? Take a look at https://salesforce.stackexchange.com/questions/376184/how-to-get-translation-of-field-label-based-on-language-and-locale – identigral Sep 12 '23 at 15:32
  • yes @identigral this needs to be an API call. I will try to raise a case with salesforce. – Manjot Singh Sep 13 '23 at 08:05

0 Answers0