You are not logged in.

#1 2009-01-19 20:06:45

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

How to set locale to German, but have program texts in English

Hi there,

I'm a bit confused about the whole locale thing and therefore have two questions.

1.) How can I configure my system's locale more specifically? I want stuff like date and money format in German as well as keyboard-mapping and filesystem-names, but keep program texts like for example nano's "interface" in English so that other users who do not speak German can use the system. How would I do that?

2.) I'm also wondering whether desktop environments like Gnome or KDE add their own layer for the locale on top. I haven't installed X yet. I'm just curious. What happens when I change the regional and language settings in Kontrol Center. How does that interact/interfere with the "low level" locale settings I created via "locale-gen"?


Thanks a lot in advance for your help.

Blackhole

Last edited by blackhole (2009-01-23 20:20:01)


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#2 2009-01-19 22:16:22

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: How to set locale to German, but have program texts in English

Hi, blackhole,

in my ~/.bashrc I initialize the locales as follows:

LANG=en_US.UTF-8
LC_ADDRESS=pt_PT.UTF-8
LC_COLLATE=C
LC_CTYPE=en_US.UTF-8
LC_MEASUREMENT=pt_PT.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_MONETARY=pt_PT.UTF-8
LC_NAME=pt_PT.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_PAPER=pt_PT.UTF-8
LC_TELEPHONE=pt_PT.UTF-8
LC_TIME=pt_PT.UTF-8

You will probably use something like de_DE.UTF-8 UTF-8 .

Dont forget to uncoment the locale in /etc/locale.gen and run locale-gen afterwards.

I never used the regional settings of gnome or kde, just use the low level.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#3 2009-01-19 23:03:56

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: How to set locale to German, but have program texts in English

Mektub wrote:

I never used the regional settings of gnome or kde, just use the low level.

Mektub

Erm, if that's only in my ~/.bashrc, then it doesn't have any effect when I login via KDM, right? Now I'm confused. How does your KDE/Gnome know about your locale, if your bashrc is never read??? Or do you use a text login?

However, thanks a lot for your explanation. That at least made things a bit clearer for me.

I'd still be interested what Kontrol Center displays on your system. wink Does it say Portuguese or does it say English?

Oh, and btw, what does the variable "LANG" exactly mean? Is it just the text language or does this also affect the encoding in my bash/filesystem?

Last edited by blackhole (2009-01-20 19:49:42)


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#4 2009-01-19 23:51:41

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: How to set locale to German, but have program texts in English

blackhole,

Ähm, if that's only in my ~/.bashrc, then it doesn't have any effect when I login via KDM, right? Now I'm confused. How does your KDE/Gnome know about your locale, if your bashrc is never read??? Or do you use a text login?

Yes, you are absolutely right. I sometimes forget that there are many ways of using Linux.

I dont use Gnome or Kde, at least not as my desktop. I use IceWm, but of course it doesnt know about my .bashrc either.

I do use a lot of command line and thats where my settings help me  but this will probably not help you at all.

The KDE application that I sometimes use is Kmail, and on my icewm menus I have:

KDE_LANG=pt  kmail

For whatever reasons kde wants a KDE_LANG, go figure.


Ok, if I start f.e. thunar from menus, I get the american way of date (mm/dd/yy), from the command line (99%) the EU (dd/mm/yy).

I'd still be interested what Kontrol Center displays on your system.

On the 'Regional & Language - System Settings' of the KDE systemsettings, it says:

Country or region: Not set (Generic English)

(had never noticed that)

I think LANG is generic and sets all LC_* at once.

Now that I think of it there must be a better and cleaner solution for this problematic.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#5 2009-01-20 19:48:18

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: How to set locale to German, but have program texts in English

Mektub wrote:

I think LANG is generic and sets all LC_* at once.

Yeah, that's right. I've done a fair bit of googling now. What I couldn't find at all via Google was a proper explanation of the different values LC_COLLATE can get assigned. I know it's got something to do with sorting, but on all websites it just says "Put it on 'C' because of compabitility reasons with older programs" without further explanation what the different behaviour for the different values like "C", "POSIX", "de_DE.utf8" etc. is. sad

Do you know more about that?

Mektub wrote:

Now that I think of it there must be a better and cleaner solution for this problematic.

I agree, it seems to be a bit of a mess with all those different layers of locales. Maybe someone knows more about all that. Let's see...

Thanks a lot so far. I appreciate your help.


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#6 2009-01-20 20:50:49

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: How to set locale to German, but have program texts in English

blackhole,

Yeah, that's right. I've done a fair bit of googling now. What I couldn't find at all via Google was a proper explanation of the different values LC_COLLATE can get assigned. I know it's got something to do with sorting, but on all websites it just says "Put it on 'C' because of compabitility reasons with older programs" without further explanation what the different behaviour for the different values like "C", "POSIX", "de_DE.utf8" etc. is.

Theory says that LC_COLLATE affects the sort order. This affects for example the output of plain "/bin/ls". It should sort
"ä" after  "a"in german and after "z" in finnish. Thats the theory because a while back I did some tests and they were not
conclusive, aggravated by the fact that some applications introduce their own collating sequence files.

Mektub

PS: By the way, collating values seem to be here: /usr/share/i18n/locales

Last edited by Mektub (2009-01-20 20:57:05)


Follow me on twitter: https://twitter.com/johnbina

Offline

#7 2009-01-21 13:05:04

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: How to set locale to German, but have program texts in English

I'm not sure how you login but wouldn't it know about those environment variables if you logged in from the console?


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#8 2009-01-21 15:48:09

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: How to set locale to German, but have program texts in English

R00KIE wrote:

I'm not sure how you login but wouldn't it know about those environment variables if you logged in from the console?

Yes, it would, but I was wondering how all the locale-layers work together and whether my desktop environment knows/has to know about those "LC_*" environment variables even (or especially) when I log in via KDM or GDM.

But apparently the "LC_*" variables are only importent for the console level and the desktop environments (or maybe even X itself) actually ignore them altogether and rely on their own localisation system.
Can anybody confirm this?

But then, what happens when I start nano via an icon from my KDE bar (not that I would do that, but hey, I'm just curious...). Would it be in German or in English? hmm
Maybe I should try that... once I managed to install a desktop....

Last edited by blackhole (2009-01-21 15:48:37)


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#9 2009-01-21 19:34:18

Nezmer
Member
Registered: 2008-10-24
Posts: 559
Website

Re: How to set locale to German, but have program texts in English

Did you have a look at '/etc/profile.d/locale.sh' ?


English is not my native language .

Offline

#10 2009-01-21 20:57:50

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: How to set locale to German, but have program texts in English

Nezmer wrote:

Did you have a look at '/etc/profile.d/locale.sh' ?

In order to do what? It says "export LANG=de_DE.utf8" which is fair enough, but I think /etc/profile.d/locale.sh is not executed by GDM/KDM.
However, I think /etc/environment will do the trick, as it should be read even when login in via GDM/KDM

Still I'd be very interested in someone describing me how the different layers of localisation work together. Does KDE or Gnome take notice of / use the "LC_*" variables in any way?

Thanks a lot for all your tips so far. I'm looking forward to getting even more insight into the whole localisation issue.


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#11 2009-01-22 04:21:19

damjan
Member
Registered: 2006-05-30
Posts: 453

Re: How to set locale to German, but have program texts in English

set
LANGUAGE=en
LANG=de_DE.UTF-8
in ~/.xprofile (and ~/.profile if you login to the console)

ps
and when I say set I mean you need to 'export' them - but surelly you knew that smile

Last edited by damjan (2009-01-22 04:22:47)

Offline

#12 2009-01-23 12:01:45

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: How to set locale to German, but have program texts in English

damjan wrote:

set
LANGUAGE=en
LANG=de_DE.UTF-8
in ~/.xprofile (and ~/.profile if you login to the console)

ps
and when I say set I mean you need to 'export' them - but surelly you knew that smile

Yep, in my case ~/.xprofile did the trick. Now applications started from the icewm menus inherit the settings.

I wasn't aware of xprofile, thanks very much damjan.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#13 2009-01-23 18:37:03

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: How to set locale to German, but have program texts in English

Mektub wrote:

Yep, in my case ~/.xprofile did the trick. Now applications started from the icewm menus inherit the settings.

I wasn't aware of xprofile, thanks very much damjan.

Mektub

I'm still wondering about the layers, Mektub. As you've "fixed" that now, what's Kontrol Center saying now? Does it say anything different from "Not set (Generic English)" under "Country or region"?

Just being curious. ;-)


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#14 2009-01-23 19:14:16

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: How to set locale to German, but have program texts in English

i'm curious about these 'layers' myself... it seems your computers locale can take shape from /etc/rc.conf, /etc/rc.sysinit, /etc/profile, and now /etc/xprofile? and then you've got the LC_* settings in .bashrc...

any good locale tutorial links?

Last edited by brisbin33 (2009-01-23 19:23:09)

Offline

#15 2009-01-23 19:35:48

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: How to set locale to German, but have program texts in English

blackhole wrote:

I'm still wondering about the layers, Mektub. As you've "fixed" that now, what's Kontrol Center saying now? Does it say anything different from "Not set (Generic English)" under "Country or region"?

Just being curious. ;-)

It still says "Not set (Generic English)", but that was to be expected. As I said above, I dont use KDE nor Gnome.

I just happen to have "systemsettings" (formerly kontrol-center) installed, I suppose because I still have Kmail installed.

Icewm does'nt fiddle with language or keyboard, it leaves that to the system, in the KB case to rc.conf for text mode
and X for graphical mode.

Possibly now i will not need the LC_* settings in .bashrc. I will test it this weekend.

What concerns KDE I think that must be something different. To have languages in KDE you must install packages like:

kde-l10n-de 4.1.3-1
kde-l10n-fr 4.1.3-1
kde-l10n-it 4.1.3-1
kde-l10n-pt 4.1.3-1

and then possibly go  thru the KDE setup.

Since I use all of them, I prefer to have several menu entries that look like:

KDE_LANG=de kmail
KDE_LANG=fr kmail

ans so on.

So I can use several languages without rebooting.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#16 2009-01-23 20:16:55

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: How to set locale to German, but have program texts in English

Mektub wrote:

It still says "Not set (Generic English)", but that was to be expected. As I said above, I dont use KDE nor Gnome.

I didn't expect that, as I thought even KDE-applications might use the LC_* variables from text mode, if they are set correctly.

Mektub wrote:

Icewm does'nt fiddle with language or keyboard, it leaves that to the system, in the KB case to rc.conf for text mode
and X for graphical mode.

If I interpret your statement above correctly, you're saying that X also has its own language settings. Where do I set those? So if I use let's say KDE then I have to set my language / locales three times.

1.) In rc.conf / LC_* variables for text mode
2.) For X applications in some place that you hopefully will tell me in your next post ;-)
3.) In Kontrol Center (having installed language packs first) for KDE applications

Is that correct?

Last edited by blackhole (2009-01-23 20:25:47)


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

#17 2009-01-24 06:57:13

damjan
Member
Registered: 2006-05-30
Posts: 453

Re: How to set locale to German, but have program texts in English

mini howto:
there are two subsystems in i18n in Linux, locale (implemented in glibc) and translations (gettext, etc..).
The locale is controlled by the LANG and LC_* environment variables. LANG is what the default setting is; but a specific LC_xx overrides that; and LC_ALL overrides all the other LC_xx variables. Running "locale" will tell you what you setup is.

Generally you only need to set LANG for the locale, some people like to set LC_COLLATE=C so that sorting is based on the default C non-locale.

gettext OTOH uses the LANGUAGE env. var. This variable is actually a list, so you can specify several languages like LANGUAGE=de:fr:es:en with the first beeing tried first, etc. If the LANGUAGE variable is not set gettext infers it from LANG.


Now, to understand all of this, you need to know how environment variables work in Unix/Linux. They are only inherited from a parent to a child process. You can't set the environment to an already running process. Also, a lot of programs clear the environment. login for example, KDM/GDM/etc will also start with a clear environment, ssh also. You can inspect the environment of all process in Linux with the command "cat /proc/PID_HERE/environ | xargs -0 -n1".

Now, when you login via KDM/GDM what happens is that they ussually run /etc/X11/xdm/Xsession. This is a shell script and it gets started with a clean environment, running as the user that just logged in.

That script does several things but at the end will start/execute ~/.xsession (if it exist) or do something else (you can look it up). 

Now ~/.xsession first `sources` ~/.xprofile. Sourceing, in the shell world, means it will read the file and execute the commands in the same shell, so that if you set the variables in ~/.xprofile the ~/.xsession process will get them in its environment.

NOTE that it doesn't execute ~/.xprofile as a script, since then that would be a child process, and remember a child process can't change the environment of it's parent.

Then ~/.xsession would start your DE (startkde, gnome-session.. etc). The DE will again inherit the environment, and as startkde starts the other KDE components they inherit the environment too, and everything is cool and fine.

Now this is the "canonical" X way how things should work, KDM or GDM might do something else (at one time Ubuntu didn't honor ~/.xprofile for ex.). You can compare to /usr/share/config/kdm/Xsession for ex.

Also note that variables set in /etc/rc.conf or rc.sysinit will be pruned from the environment when the user logs in with KDM (this is a security requirement).

Offline

#18 2009-01-24 08:51:29

blackhole
Member
From: Karlsruhe, Germany
Registered: 2008-12-14
Posts: 148
Website

Re: How to set locale to German, but have program texts in English

Thanks for these detailed explanations about environment variables, damjan. Most of it I already knew, though. I guess the most important point was this one:

damjan wrote:

Now this is the "canonical" X way how things should work, KDM or GDM might do something else

big_smile
After more googling wich wasn't too successful, one thing became clear. Everybody is confused how KDE is messing up the simple, - as you call it - canonical way how to handle locales. Even if the LANG / LC_* variables are set correctly (meaning visible to the KDE processes), KDE just seems to partly ignore and / or overwrite the LANG and / or LC_* variables and nobody really seems to be able to tell how this mess works.

Well, I'll find out soon, as I plan to do some "experiments" with KDE language settings vs. environment variables.

Thanks again.


Coming closer and closer to the ultimate goal: replacing boring old Windows XP desktop with shiny new Arch KDE 4 desktop. ^^
Already registered? Your vote counts!

Offline

Board footer

Powered by FluxBB