This the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Appendix API for Automatic Translation Jobs Creation

Lionbridge Connector for SAP Commerce supports an API to create translation job programmatically using the defaultCtProducerClient bean:

/**

* The bean creates a Translation Job that will be sent by the connector’s cron job. Example usage in psuedo-code:

* ctproducerclient = spring.getBean(“defaultCtProducerClient”);

* modelService = spring.getBean(“modelService”);

* for (…) {

* //… gather a list of items

* long examplePK = 8796093251585L;

* item = modelService.get(PK.fromLong(examplePK));

* items.add(item)

* }

* provider = ctproducerclient.getProviderByName(“WorldServer Test”);

* ctproducerclient.createJobFromItemModels(“test job”, “this is a test”, null, “123456”, null, provider.getId(), “en”, {“fr”, “es”}, items);

* @param jobName Name of translation job

* @param jobDescription Description of the job

* @param dueDate Due date. Optional.

* @param poReference Purchase Order reference. Optional.

* @param sourceLanguage Source language code (Hybris)

* @param targetLanguages List of target language codes (Hybris)

* @param lspId ID of TranslationProvider. See getProviderByName(String providerName)

* @param itemsToTranslate List of Hybris ItemModels to translate. Can be retrieved using

* ModelService or FlexibleSearchService, for example.

*/

void createJobFromItemModels(

final String jobName, final String jobDescription,

final Date dueDate, final String poReference,

final String sourceLanguage, final String[] targetLanguages,

final String lspId, List<ItemModel> itemsToTranslate);