I'm trying to change the language of a running program, for example firefox, from the command line.

I'm not looking for application specific commands, but for something like:

:~$ chglocale $(pidof firefox) en_US.UTF-8

Is there something like that?


Some programs react to environment variables by selecting e.g. messages and formats at startup. This is hard work, not all do. Some also offer commands to change this at runtime.

You can't change environment variables for a running process, and if you could, it is very unlikely that the program monitors if they change and reconfigures.

  • I figured that it would be application specific. But I can't change an environment variable for a running program? Never thought about it, but also seems like something that should be possible somehow. – Minix Jan 26 '16 at 22:33
  • 2
    @Minix Technically, there's no such thing as a program's current environment, only environment passed when the program is started (with the execve system call). Querying a program's environment gives you a copy of that original environment (which on some Unix variants may have been edited in place by the program or by a debugger). Changing a program's current environment doesn't really make sense anyway because that doesn't affect past decisions that the program may have taken based on the content of the environment. – Gilles 'SO- stop being evil' Jan 26 '16 at 22:37
  • 1
    @Minix, perhaps by digging into the process with a debugger (here in Linux /proc/<pid>/envion is strictly read-only), but (as I said) programs usually check their environment variables on startup, set up stuff, and forget about them. So it makes little sense to futz around with them. – vonbrand Jan 26 '16 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.