Setting locale for individual programs

Dariusz J. Garbowski thuforuk at yahoo.co.uk
Tue Jul 11 20:16:23 UTC 2006


On 07/11/2006 03:33 PM, Dotan Cohen wrote:
> I send this message to both the Ubuntu and Kubuntu lists as I'm not
> sure which is more appropriate. I've Ubuntu installed, and added KDE,
> which I use instead of Gnome.
> 
> My locale is Hebrew, and I need all my GUI apps to be in Hebrew,
> naturally. However, my command-line and development apps I need to be
> in English, as the Hebrew support is very poor. The specific apps that
> I want in English would be:
> Kdevelop
> Eclipse
> make (when building from source in Konsole)

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. From "man bash":


LC_ALL This variable overrides the value of LANG and any other LC_ 
variable specifying a locale category.


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).

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 :-)

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.

Have fun!

Regards,
Dariusz


		
___________________________________________________________ 
All New Yahoo! Mail – Tired of Vi at gr@! come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html





More information about the kubuntu-users mailing list