VBS files is the worst
Yesterday I was whining about a bunch of command line utilities in Windows. As useful as they are, they're a pain to localize. Turns out, they're not so bad after all - compared with some of the VBS file we have.
Open a command prompt window
Type "cscript eventquery.vbs /?" and press enter
Look at that - pretty handy
Now, type "notepad %windir%\system32\eventquery.vbs" and press enter
As you see, this file is similar to what I described yesterday. The main difference is that this is a vbs file, not an exe and so some rules have changed.
Notice how no lines with text have line feeds in them? Linefeeds in these files are only introduced by concatenating strings - like so:
CONST L_HelpSyntax2_Message = "Skriv %2 /? om du vill ha syntaxhjälp." CONST L_InvalidParameter1_ErrorMessage = "FEL: Felaktigt argument eller alternativ - %1." InvalidParameterErrorMessage = L_InvalidParameter1_ErrorMessage & vbCRLF & L_HelpSyntax2_Message
Unlike the binaries I mentioned yesterday, in these VBS files I have no way to control the number of lines in a message. Since all I see is the values of the const strings, there is no way for me to add or delete lines (unless I want to open the file in a text editor - and I don't). Because of this, there are cases where I must pick between 1) shortening a translation, 2) ignoring the 80-char rule or 3) mess about with alignment to try and reclaim space. And if I like a shorter translation, I might end up with empty rows or I'll have to try to make it longer.
Take a look at these ones as well:
' the filters as given by the user CONST L_UserFilterDateTime_Text = "datetime" CONST L_UserFilterType_Text = "type" CONST L_UserFilterUser_Text = "user" CONST L_UserFilterComputer_Text = "computer" CONST L_UserFilterSource_Text = "source" CONST L_UserFilterDateCategory_Text = "category" CONST L_UserFilterId_Text = "id"
These are localizable, but they shouldn't be. If I translate any of these, any script that calls the utility won't work across languages. That's tough, as it might not be obvious to me whether "computer" is localizable and since these words easily get auto translated.
Finally, a quirk with VBS files. A double quote must be escaped by another double quote, or the script won't work. If your localization tool doesn't take care of this for you, you can easily break a script. If you have to use double double quotes, well, that can spread to other files through auto translation.
Be careful when you localize vbs files.