Wednesday, September 26, 2018

Translating Adobe Forms the easy way

In one of my recent SAP Sales Cloud projects (formerly known as SAP Cloud for Customer) we implemented the SAP Sales Cloud quotation proces. In this particular project four different quote types were implemented that all had an Adobe Form as an output document. Since the customer operated in six different countries, all four forms had to be translated in six different languages. By default this can be done by hand or somewhat automated by using the command line, xliff and xslt for every language. Both options are not ideal because they are not user friendly and because of the amount of work that had to be done after every functional change in a single form (either implement the functional change in every translated form or translate the form 6 times again after the functional change). To make maintenance easier I developed a desktop tool to make translation easier.

Excel/CSV based translation file

When we almost finished the project, the customer provided us with an Excel file that contained the translations for all the text and labels in the forms. The file had 4 tabs for each form and each tab had six columns. The first column contained the base text in English and the following five columns contained the translation for that text. That's when I thought wouldn't it be great if the Excel file could be used as the main translation file. Using this main translation file a CSV file can then be exported from Excel for each form. Using this CSV file and an Adobe form template it should be possible to automate translation of the form in six (or even more depending on the number of columns) languages.

Automated translation proces

The steps for the automated translation I came up with were as follows:
  1. Read the CSV file
  2. Determine languages based on first line in CSV
  3. Read the source form (technically this is just an XML file)
  4. In the XML file, find and replace the the value of the first column in the CSV with the specified translation for all languages and all lines in the CSV.
  5. Save the result form by using the filename <source filename>-<language name>

Easy to use desktop tool

The first thing I though of was a simple script in java/python/nodejs or any other language to do the steps described but I quickly came to realise that this still is not really user friendly to do the translations (still command line based). Luckily I heard of ElectronJS which gives you the possibility to write a desktop application with the UI in HTML/CSS and logic in JavaScript (NodeJS). ElectronJS also offers APIs to read and write files. The framework had all the tools I needed to create the application I had in mind.

Result

In the video below you can see the FormTranslator in action. If you are interested in the Adobe Form translator please feel free to contact me.