views:

342

answers:

2

I'm working on a Qt application that used to be a KDE application. In the old days, I just had to use some syntax like:

KDELANG=de ./my_app

That ran my_app in German, and only my_app. It might not have been KDELANG, but it was some environment variable like that.

I've spent a ridiculous amount of time trying to coax this answer out of Google, and I give up. There must be some way to run a Qt (4.5 if that matters) application in some other language without switching over my entire locale to get there.

+2  A: 

I tried it with the KDE game Kolf and

(export LANG=de_DE.UTF-8; kolf)
(export LANG=en_US.UTF-8; kolf)

did the trick for me to switch it into German or English.

I verified it with the QT application qtparted

(export LANG=de_DE.UTF-8; qtparted)

also comes up in German on my English desktop. Obviously I had to install the German language files to get the translated app working.

lothar
You can just do: LANG=de_DE.UTF-8 qtpartedThat will limit the effects to a single application.
Matthew Flaschen
@Matthew The () which create a subshell have the same effect, as the export will only be visible inside the subshell.
lothar
A: 

OK, it's a long story, but it turns out the translations are, in fact, busted, and that's the whole underlying problem here. The obvious thing I tried first works fine. Since this isn't KDE, I just used plain:

LANG=de ./my_app

Now that I've fixed the bug in the debugging code (oh, the irony) I can plainly see that the translation files (which do exist) aren't getting loaded. Ah. Alrighty then. Carry on. Nothing to see here.

Michael