MFL files is the worst

WMI is so cool! There's no end to what you can do with it! It gives you all kinds of information about your hardware - right down to the number of function keys on the keyboard! It allows you to manage software on the computer - see what's installed (even version and serial number) and also changing settings!

Most of these features are described in a file called cimwin32.mfl. This is a simple text file that's compiled as you set up your machine. The text file contains just over 100,000 words to localize.

What's tricky about these files, besides the size, is that they're quite syntax sensitive. It's easy to break an MFL file as you localize it, and if you do a lot of stuff can break.

The biggest thing is that you have to escape a lot of characters inside this text file. Line feeds must be escaped into \n. Double quotes must be escaped into \". Back slashes must be escaped into \\. Tabs must be escaped into \t. Depending on your localization tool you might see these as doubly escaped - \\n, \\", \\\\ and \\t.

It's easy to make a mistake with escaped strings, and you might not even notice until you get a build where, say, Device Manager doesn't work well. Luckily, it's pretty easy to check if a file is correct. Simply use mofcomp like so:

mofcomp -check %windir%\system32\wbem\cimwin32.mfl

The next problem is around consistency. Here's something in cimwin32.mfl:

  [Description("IRQ trigger type indicating whether edge (value=4) or level triggered (value=3) interrupts occur. Also, \"Other\" (1) and \"Unknown\" (2) may be defined.") : Amended ToSubclass,Values{"Other", "Unknown", "Level", "Edge"} : Amended ToSubclass] uint16 TriggerType;

In my localization tool, I see this as five individual strings:
15; "uint16:TriggerType" - IRQ trigger type indicating whether edge (value=4) or level triggered (value=3) interrupts occur. Also, \"Other\" (1) and \"Unknown\" (2) may be defined.
15; "uint16:TriggerType\\VAL" - Other
15; "uint16:TriggerType\\VAL" - Unknown
15; "uint16:TriggerType\\VAL" - Level
15; "uint16:TriggerType\\VAL" - Edge

One thing I need to keep in mind is keeping the names of the values consistent. A second thing to keep in mind is that many enumeration values are repeated all over the file - Other and Unknown are particularly popular. I might need to have different translations of these depending on what they refer to, so auto translation can trip me up once again.

100k+ words, said I. 100k+ words worth of descriptions and display names of classes, methods, events and properties. Who reads this though? No really, who? I don't think I've ever seen these strings in runtime. Has anyone seen them? Was it worth my time translating, spell checking and inconsistency-checking..? Also, what's the impact if I'm inconsistent in the example above? So far I've been doing my best to keep consistent because anything else would at least be misleading, but I honestly don't know if an inconsistency could have functional implications. Anyone knows...?