Is there any way to set a system environment variable for the currently running application from within the application itself? I don't intend to change the system environment variables for the entire system, only for my application and for the duration of its execution. You may wonder why I would want to do this. It appears that in order to localize the QAssistantClient, one has to specify the system variable LANG, e.g. LANG=ca. If I then start the assitant with the "-resourceDir" argument specified, it picks up the correct translations.

I have also tried to instead do the following in main.cpp, hoping the QAssistantClient would pick up the translation, but with no luck.
Qt Code:
  1. QTranslator translator;
  2. translator.load(":/translations/assistant_ca.qm");
  3. a.installTranslator(&translator);
To copy to clipboard, switch view to plain text mode 

So, does anyone know how I can set the value of the variable LANG from within my app (for the duration of the execution without affecting the actual system variables)? Or even better, how to make the QAssistantClient pick up a translation without using system environment variables.

Thanks in advance.