Sunday, March 11, 2012


MP3 Diags is finally translatable. I have no idea when I would have done it without an external push, but the push came from Pavel Fric in the form of translated dialogs, so now it's done. I "merely" had to make the code translation-aware. That required hundreds of changes, and I think it's the most extensive change since the project was made public. So even if I tried to check all the changes and retested most things, chances are that I broke some functionality. Anyway, it's quite unlikely for anything to be impacted besides the messages and tooltips shown on various occasions, so the program should work pretty much the same as before. Or if it doesn't, it should crash without doing any other damage. Well, I hope there will be some who will test it and report back any issues they encountered.

Currently only a Czech translation exists, but more can now be easily added.

I didn't update the documentation, but I hope changing the language is intuitive enough: above the fonts, in "Configuration / Others", by a big UN flag. This one requires restarting the program, or at least the session, but if you have a fresh install or use multiple sessions, the language can be changed from the session editor as well.

Since the translation issue came up before, I expect some would be interested in playing with it, so here are the basic things they need to know, using Italian as an example and the forward slash as the path separator:

- While you really need just an XML file to make a translation, you should create that file from Qt Linguist, which AFAIK comes with Qt SDK, so you should get that (on Linux this comes with a "Qt4 Devel" package - "libqt4-devel" on openSUSE.)

- Next you need the MP3 Diags sources. While for playing on your own, anything listed in the download page should work, if you want to actually contribute and maintain an official translation for MP3 Diags, you should use some Subversion client, to access the repository.

- Each new language requires an entry in the file src/, in the TRANSLATIONS section. For Italian, it would be like this:
TRANSLATIONS = translations/mp3diags_cs.ts \

- You should now open a terminal / command prompt, go to the directory where you have the sources and run this command:
lupdate src/
It should create a file named src/translations/mp3diags_it.ts (obviously, you need "lupdate" to be in your "PATH", so you might need to adjust it. This should be run again as the program changes.

- You should open this file with Qt Linguist (the executable's name is just linguist on some Linuxes and linguist.exe on Windows), then do the translation. One nice thing it does is that it allows you to see the UI dialogs and the source code that correspond to a text that has to be translated, which can be helpful on many occasions, even for non-programmers.

- When you are done or whenever want to test something, you can "Release" the translation using the menu entry "File/Release". This will create the file called src/translations/mp3diags_it.qm. You can copy this file to the directory where the MP3 Diags executable is located (version 1.1.16 or later) and it will show up as an option when choosing the language and you'll be able to see the results of your work immediately.

More details here, here, or here.

If you want to contribute an "official" MP3 Diags translation, please let me know first, in order to avoid several people doing the same work.

Note: the translation is meant for left-to-right languages. I didn't look into it, but imagine a lot of other changes would be needed for right-to-left languages.

Note for packagers: have a look at package/rpm/MP3Diags.spec or package/deb/debian.rules for what needs to be changed to support translations.

No comments:

Post a Comment