You are here:
TranslationService
Returns string translations and translations for specified Salesforce object fields. To create string translations, go to the Vlocity Product ConsoleCreate Products in the Product Console. To define translations for object fields, go to the Vlocity CMT Administration tab.
If no translation strings exist for the specified locale, the base language names of the fields are returned.
Method Names
getSobjectFieldsTranslatedStrings
Returns field translations for a specified list of Salesforce objects.
Fields in objects that are the detail part of a master-detail relationship cannot be translated.
Arguments:
-
sobjectList(List<sObject>): List of sObjects for which translations are requested.
-
localeCode(String): Valid Salesforce locale code.
getTranslatedStrings
Return a map containing translations for a specified list of strings.
Arguments:
-
stringSet(Set<String>): Set of strings for which translations are requested.
-
localeCode(String): Valid Salesforce locale code.
isMultiLanguageCatalogSupportEnabled
Returns Boolean: true if multi-language support is enabled, or false if not enabled.
Sample Code
Retrieve product names, descriptions, and product codes and translate them into Finnish.
List<SObject> prodList = [Select Name, ProductCode, Description From Product2];
System.debug(json.serializePretty(prodList));
List<SObject> transProdList = TranslationService.getSobjectFieldsTranslatedStrings(prodList, 'fi');
System.debug(json.serializePretty(transProdList));Retrieve pricing element fields and translate them into Finnish.
List<SObject> pelist = [Select Id, Amount__c, DisplayText__c, PriceListId__c, PriceListId__r.Description__c, PriceListId__r.Name, Name from PricingElement__c];
System.debug(json.serializePretty(pelist));
List<SObject> transPEList = TranslationService.getSobjectFieldsTranslatedStrings(pelist, 'fi');
System.debug(json.serializePretty(transPEList));
