Setting locale for individual programs
Dariusz J. Garbowski
thuforuk at yahoo.co.uk
Tue Jul 11 23:02:17 UTC 2006
On 07/11/2006 10:52 PM, Dotan Cohen wrote:
> On 11/07/06, Dariusz J. Garbowski <thuforuk at yahoo.co.uk> wrote:
>> Say I wanted to run "ls -l" with Polish locale. I'd type in shell (bash):
>> LC_ALL=pl_PL ls -l
>> This will run ls with pl_PL locale. What happens is that LC_ALL
>> environment variable is set for the next command.
> Yes, only for the next command. I didn't realize that at first, so I
> was wary of using it.
You can mkae it affect all commands (not only the following one) by running:
$ export LC_ALL=pl_PL
This will make it "permanent" for this shell session, at least until you
change it again ;-)
>> You can find more on other locale related variables in "man bash"
>> (search for LC_ALL). This way you can have fine grained control of
>> locale environment, e.g. have numbers displayed in one locale
>> (LC_NUMERIC), messages in another (LC_MESSAGES), etc. Note: bash manual
>> is not complete when it comes to LC_ variables -- search google for
>> more! LC_ALL will do if you want everything to be in one locale (which
>> is typically what people usually want).
> LC_ALL is what I'm setting. Though I may micro-manage it in the future.
BTW: you can see a little more running:
On my Fedora box it results in (similarly on my Kubuntu, but with
en_GB.UTF-8, where I chose to use British English):
Additionally it most likely makes sense to setup to locale with the
"UTF-8" postfix so that UTF-8 (Unicode) is used.
>> You can make an alias and have your selected applications always run
>> with specific locale (when run from bash). Edit ~/.bashrc and add
>> something like this:
>> alias make='LC_ALL=en_US make'
>> Open new terminal to try 'make' -- it should be in English from now on
> Excellent! That's much better than creating shellscripts for each program.
>> Note: .bashrc will change locale for apps run from command line only, so
>> if you run them from some GUI, or K-menu/panel/etc. you might need to
>> modify other places, liked desktop entries or configuration of your IDE.
> Hm, this seems to be my problem. When I do type firefox at the command
> line, I get my 'modified' firefox. But the KDE menu still gives me the
> standard Fx. I've been able to figure out by googleing the topic that
> for gnome I would modify .gnomerc, but I can't seem to locate the KDE
> equivelent. But at least now I have a slight clue.
It's easy in KDE: right mouse button click on K-menu and choose "Menu
Editor". In Menu Editor select shortcut you want to modify and modify
"Command" by adding LC_ALL=en_US.UTF-8 in front of whatever there is
already. Don't forget to "Save" your changes after you are done editing
menu! It should work from now on.
If you want to know what exactly is modified, read on "Desktop Entry
Specification" (it applies to Gnome, KDE and any desktop environment
that adheres to this standard):
>> Have fun!
> I am! I'm really finetuning this system, and feel for the first time
> that this is 'my' computer- set up how I like it, not how Bill or
> Linus or any scampering little gnome likes it. Until now, I didn't
> know that operating a computer could be comfortable and fun.
And that's only the beginning of the adventure!
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
More information about the kubuntu-users