4

Does the Force.com REST API support internationalisation/ multiple languages? I see that if I change the user language, it is reflected in apps such as Salesforce1 where all labels are changed to use that language (for example - German). However, I have not found any documentation which suggests that if it's possible to do via REST API - that are encapsulated in the Mobile SDK.

My use case is that the app fetches a number of fields and I want to show them in the language based on the language setting in user's profile. Salesforce does it automatically for standard objects/ fields when I view it in the org. Is it possible to pass such translation information via REST API or otherwise to the app to show field labels in user's chosen language? I am able to retrieve the user's language at the time of login using language & locale fields.

2 Answers 2

4

It took me a while but I actually figured it out myself. I am posting this here just in case it benefits anyone else.

  1. For Custom Objects, the first thing you need to do is 1.Setup -> Translation Setting -> Enable
  2. Add the required Supported Languages
  3. Save the desired Supported Languages
  4. The language will then be shown as 'enabled for your organisation'
  5. Then under Component, chose the entity that you want to translate e.g. Custom Field. It will ask you to chose Object name and aspect (e.g. Field Label)
  6. Add the appropriate string literals for your desired language there
  7. Once you've configured all above and if you set the language of the user to another language (e.g. German), the Mobile SDK automatically retrieves the translated strings as part of your REST API calls.
  8. That's all - you can use the above steps and internationalise all objects/ fields used in your app!
1

Translations in SFDC are stored in metdata API as documented below

http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_translations.htm

Hence you will need to use the same which is little tedious .

If you are using VF its easy to use Custom Labels everywhere and then use translation workbench do the same .

For picklist we have toLabel functions to do the conversion as per locale of the user .

In short i guess you will first need to retrieve user langauge and locale and then do a custom conversion using the Native Mobile API or if its hybrid you can use Javascript of the browser to do the translations .

2
  • This is a native app so there's no VF involved at all. Is the Metadata API exposed as part of REST which can be used in Mobile SDK? May 15, 2014 at 9:39
  • No .We dont have this in REST as part of SDK .SO i believe i would use native API of Device to do this translation. May 15, 2014 at 17:31

You must log in to answer this question.

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