PDA

View Full Version : How to translate Media Player Classic


Brother John
10th December 2003, 14:34
After doing a couple of German MPC versions I think I've found all obstacles in the way and I'd like to share my knowledge with all the the hundreds of people ;) out there who'd like to do a translation but never got around the question: How? So I decided to write this guide.

If you feel the need to say anything about it (Errors? Omissions? Anything else?) don't hesitate!



What you need
latest version of MPC
upx exe packer, version 1.90 (http://sourceforge.net/projects/upx)
a resource editor, e.g. this one (http://www.users.on.net/johnson/resourcehacker/)
a hex editor
a lot of patience ;)
Download and unzip MPC form the guliverkli sourceforge project page (http://www.sourceforge.net/projects/guliverkli).
mplayerc.exe is again packed by upx. Unpack it with this command: upx -d mplayerc.exe


The Translation

Step 1: Editing resources
Resource Hacker displays all resources of the loaded mplayerc.exe in a tree view. The interesting branches are "Menu", "Dialog" and "String Table". Basically you do these three steps for every resource:
1. Open the resource in the tree view. The resource script is shown in the right side window.
2. Translate the script.
3. Compile the script via the "compile script" button.

There are certain things to consider.
Some menu items have to stay in English, otherwise their respective sub menus won't open. These items are Favorites, Open CDROM, Filters, Audio, Subtitles, Jump to. This applies to all three menu resources!
When editing dialogs make sure that the GUI elements (buttons, labels etc.) are not too small and cut off your translated text. You can change the size of an element by editing its size in the resource script or by dragging it to the right size with the mouse. Don't forget to compile after size changes.
Only part of the "String table" section needs to be translated. Mainly that's the the mouseover help for the "output" dialog and the tree view items in the options window.
Resource scripts separate tree view branches by a double colon, i.e. the "Player/Keys" branch of MPC's option window is represented by "Player::Keys" in the script.
These are the string resources you should edit (MPC 6.4.7.2): 9, 14, 15, 17, 18, 19, 21, 22, 67, 70, 71, 72.
Resources 32 to 38 define names for the ini file entries. Leave those as they are.
Most 4-digit-resources are error messages.
Step 2: hex editing mplayerc.exe
There are many additional strings (e.g. the playlist) only accessible via hex editing the exe file.
Probably you won't want to edit all strings in the exe, they are just too many. I only translate the status messages (Opening, Playing, Paused, etc.).

Warning 1 For the unicode version of MPC remember that every character is 2 bytes long. For a lot of languages this means having a null byte after every letter.

Warning 2 Changing the length of mplayerc.exe (i.e. inserting or deleting bytes) breaks the file. That means you have to find translations fitting into the existing space. Believe me, this can be much harder than it sounds at first.



Re-packing MPC

First compress your translated mplayerc.exe with upx:upx --best mplayerc.exe Then put it into a zip archive, maybe together with a little readme about the translation.

If you're willing to translate future versions, too, you could contact Gabest about getting access to the guliverkli project, so you can release translations on your on. Read his note on the subject (http://sourceforge.net/forum/forum.php?forum_id=332793) before you do that.

LigH
11th December 2003, 10:47
In my opinion, resource-hacking is always the worst way of translating a program; editing the source code (especially if it has one file with all the string constants) and recompiling is a better way; even better may be any technology to load the strings from an external file - a string table DLL (probably like VirtualDubMod?), or even a kind of INI file (like GordianKnot).

Brother John
12th December 2003, 15:38
I don't like the "own compile" solution that much. To do it you need to have the development software and at least basic knowledge about compiling and the programming language.
That limits the range of people being able to do a translation to programmers who often have other things in their minds.

However resource editing can be done by almost any experienced user. And it's a huge difference if you need a big software package like VC or a little resource editor.

But in one point I agree completely. A truly multilingual MPC would be best (I'd prefer the resource dll solution). Unfortunately it seems we won't get this in the near future.