KategorieStudio

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

 

 

SGML Filter for SDL Studio 2017 and/or WorldServer 11.1

To create a filter for SGML files can be a difficult and expensive task, if you don’t know how to handle those files. I can tell this from experience. First I made the misinterpretation that SGML files are similar to XML files and tried to build something around an XML filter. I didn’t work! Why? Because the SDL tools are very strict in this matter and since the SGML might have the same structure as a XML file, the header and the doctype declarations are not the same at all. So the tools denied the creation of such a filter.

The next choice was my favorite: The RegEx. With the RegEx capability of Studio and/or WorldServer you can create filters for almost any files. But unfortunately in this case the file was so strange structured with returns in the tags, that this also did not work or just with some strange workarounds which also meant to have only a 99% solution. And when it is about translation handling, 99% is not good enough.

Only when I pointed my problem to the SDL support, they came up with another solution and it worked.

The solution is a HTML5 filter. It can do much more than HTML. When you create a new HTML5 filter in SDL Studio 2017.

You start with creating a [New…] filter and choose HTML.

Give the files a unique name, a unique file type identifier and add the correct file dialog wildcard expression (e.g. *.sgm)

Choose „Define HTML elements based on SGML…“ and point it to a reference file.

 

SDL Studio identifies automatically all elements from the reference file. Here I think SDL did a great job!  Go to the next window. You just need to define which elements are translatable and which ones not. Just click on the values and choose the correct one.

Open the reference file, copy the doctype tag and paste it into the dialog.

Leave it as it is.

I choose that everything stays as it is. So „preserve“ and „Do not change“ are our friends.

I choose that everything stays as it is. So „preserve“ and „Do not change“ are our friends.

Done!

Now the filter is working and SMGL files can be processed.

 

.over-and-out

 

© 2024 hacker.li

Theme von Anders Norén↑ ↑