MonatNovember 2017

Export Excel to XML including length limitation and comments

In my previous post I showed how to handle XML comments in SDL Studio. Everything builds on my “standard” XML file with a very simple structure.

As you know life is sometimes not so easy and many people can’t create a XML file from their preferred tools. Most the time we actually get Excel files for translation. Recently there was the demand also to enforce length limitation in Excel sheets.

The good news is that this can be achieved quite easily, if you know how to do it. The ingredients for this are a XML file in the standard you would like to have and the Excel file itself.

 

The XML file has the known structure and one <Item> line would be enough.

 

Open the “Developer” tab in Excel.

 

Click on “Source”. The XML Source window opens on the right. Click “XML Maps…”.

 

Click “Add…” and choose the sample XML “Sample.xml”. Close with OK.

 

The XML structure is shown.

 

Now you need to grab the XML elements in the right window and place it on the corresponding cell in Excel.

So in this sample, drag “Ident” and drop it in cell A1. Grab “maxlength” and drop it in cell B1. Grab “<value> and drop it in cell C1. Grab “Comment” and drop it in D1.

 

 

The Excel should look like this:

 

Go back to the “Developer” tab and press “Export”.

Store the XML with any name you like.

Finished! Almost…

 

Open the XML to verify the content. The content from the Excel file is now in the XML.

 

Now you can process the file in Studio with the filter described in the last post.

 

If required, change the mapping before the import. My sample Excel has a different column for the target. So right-click on “<value> and choose “Remove element”. Then drag “<value>” and drop it on target.

 

 

The Excel looks now like this:

 

Import the translated XML file.

 

Done!

Here are the sample files: EXCEL_Sample

 

.over-and-out

XML comments in SDL Studio

How to parse a XML file to interpret a maximal file length was described in an earlier post. We continue to work with this file. A sample XML is included in the zip-archive at the end of this post.

Now we are looking how to show comments in this file in Studio, so the translators can see the additional information.

A good introduction into this topic you can find in Paul Filkin’s Blog https://multifarious.filkin.com/2013/02/22/translate-with-style/.

As he states, in Studio there is only the possibility to show the comments in the “Preview” pane. If you don’t have any stylesheet referred, then the XML source code is shown. As you might know translators, the minority are good with code, so they will struggle to find the information. Especially in a huge document, it will be very painful. But Paul has shown in his blog how to format the preview and only show the required information.

With this help I created a XSL stylesheet (Style.xsl) which will work with my XML file.

Now you just need to refer to the XSL file in the Studio filter settings. By the way: Once you selected the XSL file, the file is uploaded to the filter. Any later changes of the XSL file need to be uploaded again.

The finished filter for Studio (XML-Lenght_limited-Comments_in_preview.sdlftsettings) is also included in the zip-archive at the end of this post.

So, when you create a new project in Studio and import the XML, the preview in Studio looks like this:

 

You can open the preview pane on the right-side tab or in the top menu.

The next step is to export the filter settings (XML-Lenght_limited-Comments_in_preview.sdlftsettings). We can use this file to create the filter in WorldServer. Unfortunately, after the import to WorldServer, it shows that the “Preview” setting is not available. This is another misalignment of the file type filters in Studio and WorldServer.  But the XSL is still there…

Hi Ray! One more thing I need to get fixed… 😉

 

When you create now a Translation Kit from WorldServer and open it in Studio, it will show the comments in the way we had planned in the beginning.

If, one day SDL, will align their filters, then we can even change the XSL sheet directly in WorldServer. One day…

Download zip-archive

 

. over-and-out

 

 

© 2024 hacker.li

Theme von Anders Norén↑ ↑