TRADOS 2007 and its language codes
I bought my first TRADOS license in 2002 and never looked back. Without it, I would earn far less for my translation work, and would make many more mistakes. But sometime early in its history, the original TRADOS team decided that freelancers probably shouldn't need access to more than five languages, and that hard limit is written into the software's DNA now. And that five-language limit is a real problem, because in addition to English, I read and work with six other languages - my mainstay is German to English, but I also translate from French, Spanish, Italian, and Portuguese on a regular basis, and Hungarian on a more occasional basis. (Hungarian is hard, and I simply can't do as much in a day.)

That's seven, even before you count the very occasional jobs I've done in Catalán or Dutch.

Until recently, I thought the only recourse was to install English, German, French, Spanish, and Hungarian, then call Italian and Portuguese dialects of Spanish. If necessary, I simply edited the TTX files with a good text editor to change languages for delivery, and overall that strategy actually worked pretty well - until I got a TM in Italian one evening for delivery the next morning and couldn't read it.

Frantic research found me a post on and this brilliant blog post on the topic. As I don't worry about editing the Registry, I could quickly read my TM and finish my job (seriously, it was just 200 words, but man that was a tense situation). But as I started to use this technique more often - I had a long run of Portuguese jobs for a while, interspersed with Italian - I had to keep finding the piece of paper with numeric language codes on it every time I needed to switch, and that was just asking for trouble.

I envisioned a better tool, one that I'd just call and could use to change the installed languages in a second. And this week, I took some time, and by golly, I wrote it.

It's just in embryonic form - there are a number of improvements I need to make in terms of distribution and publication - but it's already quite useful and usable. For a simple set of installation instructions, I've put together a simple page here, but honestly you should probably just wait until I've got things working more smoothly, unless you're not afraid to do a little technical dirty work.

The rest of this article is about the technical aspects of the mechanism and the script, because I had a lot of fun figuring it out and writing it. I also have a full table of the numeric codes used in the Registry for TRADOS 2007 installed languages (to my knowledge, this is the only complete table on the Internet). That table is over here and is also available in convenient tab-delimited text format if you want to do something automatic with it.

The Registry key

The key itself is stored in HKEY_LOCAL_MACHINE\SOFTWARE\TRADOS\Shared\IDNG, but since TRADOS 2007 is a 32-bit app, if you're running under a 64-bit Windows installation it will actually be stored in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\TRADOS\Shared\IDNG. This will be transparent to TRADOS and also to Perl if you're running a 32-bit Perl, but since a 64-bit Perl will see the actual name, the code needs to check both.

The default value of that key will be something like {D7020440-18AB-11D0-B16A-004453585E5D} The only part of that we need are the last ten characters inside the curly braces; I have no idea what the rest does (or for that matter, what IDNG stands for). Each pair of characters in those ten represent a hexadecimal value that encodes an installed language. Valid codes run from 00 to 7F, and 84 seems to be used for "uninstalled" slots.

The language codes

Until I started this effort, there was no full table of valid language codes (not all the possible values between 00 and 7F are used). So I also went laboriously through all possible value from 00 to 7F to see what TRADOS Workbench would offer me for File|New to create a new translation memory. This effort took me a couple of hours, but I now have what I believe is the only full table available on the Internet. You have to focus down on pretty small things to find uniqueness in the world of the twenty-first century, but I've found at least one now.

That full table is over here, sorted by numeric code, two-letter ISO code for the languages that have them, and the name of the language. It's also available in tab-delimited text format for programming, and obviously it is also available in Perl hash format in the script that is the object of this article.

Sometime this week I'll factor all this out into a CPAN module so you don't have to write anything at all if you don't want to. But first, the reason I haven't already done that.

Setback: UAC under Windows 7

So in Perl, Registry access is done using the Win32::TieRegistry module - and for the life of me I couldn't get it to work with the examples right out of the documentation. Turns out that, like many things, the module predates Windows 7, and that Windows 7 introduced new security measures called UAC, or User Account Control. This is the system that darkens the entire screen and pops up a security dialog whenever you want to install some software. And one of the things that requires this "elevated privilege" is writing to the Registry, and Win32::TieRegistry asks for write access by default. Which is fine in our case, because we actually need write access - but the documentation doesn't actually note any of this.

Over the next day or so, I learned a lot about UAC, including at least four different ways to get that popup to appear and elevate a running script. I learned enough to write a Perl module to take care of it for me - but since I haven't done that yet, I also haven't wrapped up the TRADOS 2007 language code functionality into a module either. That will be the second article in this series, later this week.

Initial working script prototype

But I do have a working prototype! When run with elevated privilege, this script will show the current value of the IDNG key, list the languages that appear in the five installation slots, and ask you to specify a new list of five languages. The input can be the numeric code of a language, its two-letter ISO 639-1 code, or the language name as specified in Perl's Locale::Language module. (I made an exception for HR, which can be Croatian, Bosnian, or Serbian.) If using the name turns out flaky, you're probably better off just using the ISO or numeric codes anyway, but this makes things a little more convenient.

If the script gets a list of values it understands, it will write the new key to the Registry and you can immediately restart TRADOS Workbench to use the new settings. You can leave the utility running if you want to make other changes later.

Thanks to the inclusion of the language code table, the script is a couple hundred lines long and therefore ungainly to include on this page, so I've put it over here for your reading pleasure. The individual parts of the script basically break down as follows:
006-013:This is the table of language values expressed as a hash.
106-124:Here, we find the Registry key and diagnose a few possible problems that could occur.
129:We use a regexp to extract the interesting parts and throw a warning if the value is malformed.
138-145:We unpack, interpret, and display the language codes in the five installation slots.
154-184:We interpret user response, and exit the script if necessary.
191-192:Here, we build the new key and write it, then repeat the process.

I'll probably be improving this presentation style; I'm trying to learn how to write effectively about code, but there isn't much source material out there to emulate. If you know of any, please feel free to get in touch.

Going forward

Soon, I'd obviously first like to pull all the language code functionality out into a nice module, then rewrite the script to use the module. And since modules can install scripts that act as system commands, you won't even need the script - just type something like "ttxl" and this utility would pop up.

To do that, I'll need to write the UAC handling module to make it easy for Perl to know it's not in elevated mode yet, and restart itself with elevation. That won't take long.

Later still, I'd like to revisit this issue with a bog-standard C program that pops up a simple GUI to allow the languages to be selected graphically. That's when we can talk about simplicity of use. But that will take some more research, and obviously TRADOS 2007 is getting pretty old. I'm not really sure it's worth the effort at this late date.

The second part of this article series will be examining the same thing for SDL TRADOS Studio - because that system is much more complicated and interesting. In fact, I don't even have it figured out yet, although I can already save installed language configurations for later reactivation, which has simplified my life greatly.

That article will be a lot more fun. So stay tuned!

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.