Looking cool…

Using stylesheets to enhance the translators experience when working with XML files can be very helpful and sometimes essential.  It allows you to pull details from the XML and display them in a preview pane so that the translator has more context around the translatable text.  It can also provide a mechanism for displaying text that you don’t want extracted from the XML for translation at all.  This is nothing new of course and localisation engineers and experienced translators have been doing this for years.  In fact I’ve even written about this in the past providing a simple example of how it’s done and some reading resources for anyone who would like to learn how.  So why am I bringing this up again?

To answer my own question it’s because when I first looked at how to create a stylesheet, and because I’m certainly no expert in this area, one thing I found tricky to deal with was getting the preview right.  I don’t mean technically, although that is challenging for me too, but rather having to repeatedly replace the stylesheet in the XML filetype settings in Studio and then open a file for translation to see whether my changes were good or not.  This is because I don’t use applications like XMLSpy or Oxygen for these things, I just use a text editor like Notepad++ or EditpadPro.  There may be plugins for the last two, and there are probably a host of other applications for XML that support the use of stylesheets in a helpful way, but I simply don’t have the need for them.  So, when I was working on a presentation for the ATA in Miami a few years ago I asked one of our developers if they could make me one… and he did!

So that’s why I’m bringing this up again… I don’t know why I left it this long but after working on some stylesheets for a number of customers recently we thought it would be a good idea if we made this really handy and simple preview tool available to others as well.  So we did… it’s now available as a plugin to SDL Trados Studio through the SDL AppStore.  I don’t propose to explain how it works in detail since the team created a wiki article for it in the SDL Community, but suffice to say it’s a very simple select your stylesheet, select your XML and click preview!  It doesn’t get more simple than that but does exactly what I wanted.  On that basis I hope you find it useful too!

Something else useful…

Now, I can’t leave this article without pointing out something else useful for this tool.  Last week I was asked how to get a list of all the XML elements in an XML file so that it would be easier to make sure that you had been through all of the file and created parser rules where appropriate, not missing any of the translatable text.  On a simple file this would not be necessary, but this one had 712 unique elements occurring over 3000 times in the sample file, so whilst this still isn’t massive it does represent a challenge when you need special rules for each element to get at the translatable text.  To help the user, and because I didn’t know a way to do this at first, I googled it and came across this article published in a book on XSLT:

https://docstore.mik.ua/orelly/xml/xslt/appd_03.htm

Using the plugin developed for the Studio preview I was able to select this ready made stylesheet, select the XML, click preview and I got an html file in the preview like this:

This doesn’t seem particularly helpful and I was just about to look at how to change the stylesheet to render it in a more readable way when I realised that the preview.html file created with the plugin was just a file with the extension html but it’s not actually an html file at all.

It’s a file based on the logic of the stylesheet and if I open it in a text editor it just lists all the elements in the file like the image on the left.  Now it’s completely usable!

All credit to Doug Tidwell the author of XSLT who is smart enough to write the stylesheet in the first place, but it did make me realise how much more useful this little plugin actually is.  It also made me think I need to learn more about XSLT because I can think of quite a few occasions where it would have been beneficial to create a new type of file out of some crappy format that had been delivered for translation and make the translation effort look cool in Studio, then put it back afterwards; or even just extract information from a text based file for other purposes.  I often use excel as the “middleman” for these sort of exercises but the ease of using this plugin is making me think again.  The book from Doug Tidwell seems like a good place to start!

2 comments
  1. Jesse Good said:

    Hi Paul

    Concerning the list element names, the following site has quite a few handy tools:
    http://taporware.ualberta.ca/~taporware/xmlTools/listxml.shtml

    As an inspiration from the above site, it would be interesting to make a website with a bunch of little tools like this catered to translation… maybe in my next lifetime…

    Like

    • Thank Jesse… that looks very interesting. I reckon there are probably websites out there doing this kind of thing, but perhaps just well hidden. I’ll look forward to seeing yours and will share it well!

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: