FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 06-22-2010, 01:14 AM
Christopher Swift
 
Default Questions regarding the usage of multiple locales

I've setup my Gentoo box to use en_GB as the default locale
in /etc/env.d/02locale with tips from the Gentoo Localisation Guide[0].
Is it at all possible to set a locale, i.e. cy_GB to be the primary LANG
parameter but if there is no .po for cy_GB or the .po is incomplete to
use en_GB as a backup instead of the default en_US? So for example if
gedit were fully translated into Welsh (cy_GB) I could use gedit in
Welsh but emerge not being translated into Welsh would resort to en_GB
instead of en_US?

Many thanks / Diolch yn fawr iawn,
Chris

[0] http://www.gentoo.org/doc/en/guide-localization.xml
--
Christopher Swift <christopher.swift@linux.com>
 
Old 06-22-2010, 01:38 PM
Mick
 
Default Questions regarding the usage of multiple locales

On 22 June 2010 02:14, Christopher Swift <christopher.swift@linux.com> wrote:
> I've setup my Gentoo box to use en_GB as the default locale
> in /etc/env.d/02locale with tips from the Gentoo Localisation Guide[0].
> Is it at all possible to set a locale, i.e. cy_GB to be the primary LANG
> parameter but if there is no .po for cy_GB or the .po is incomplete to
> use en_GB as a backup instead of the default en_US? *So for example if
> gedit were fully translated into Welsh (cy_GB) I could use gedit in
> Welsh but emerge not being translated into Welsh would resort to en_GB
> instead of en_US?

I'm also interested in this - although my question is probably simpler:

I would like to use en_GB but I do not undestand why running 'locale'
as a plain user shows:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

why when running it as root:

# locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=


I do not have set a /etc/env.d/02locale yet, so where is my plain user
locale being read from?
--
Regards,
Mick
 
Old 06-22-2010, 04:14 PM
Christopher Swift
 
Default Questions regarding the usage of multiple locales

Ar Maw, 2010-06-22 am 14:38 +0100, ysgrifennodd Mick:
> I'm also interested in this - although my question is probably simpler:
>
> I would like to use en_GB but I do not undestand why running 'locale'
> as a plain user shows:
>
> $ locale
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=en_US.UTF-8
>
> why when running it as root:
>
> # locale
> LANG=
> LC_CTYPE="POSIX"
> LC_NUMERIC="POSIX"
> LC_TIME="POSIX"
> LC_COLLATE="POSIX"
> LC_MONETARY="POSIX"
> LC_MESSAGES="POSIX"
> LC_PAPER="POSIX"
> LC_NAME="POSIX"
> LC_ADDRESS="POSIX"
> LC_TELEPHONE="POSIX"
> LC_MEASUREMENT="POSIX"
> LC_IDENTIFICATION="POSIX"
> LC_ALL=
>
>
> I do not have set a /etc/env.d/02locale yet, so where is my plain user
> locale being read from?
Your plain user locale is usually read from ~/.bashrc, this can be set
to en_GB by having the following lines:
export LANG="en_GB.UTF-8"
export LC_COLLATE="C"

This will only affect that user but if you want to define a locale globally you have to adjust the file in /etc/env.d/02locale to have the top two lines read this:
LANG="en_GB.UTF-8"
LC_COLLATE="C"

After you've done that do "env-update && source /etc/profile" for the global settings or just source ~/.bashrc for the user's settings.

Hope this helps
--
Cofion

Christopher Swift (ianto) - christopher dot swift at linux dot com
 
Old 06-25-2010, 06:05 PM
Enrico Weigelt
 
Default Questions regarding the usage of multiple locales

* Christopher Swift <christopher.swift@linux.com> wrote:

> Is it at all possible to set a locale, i.e. cy_GB to be the primary LANG
> parameter but if there is no .po for cy_GB or the .po is incomplete to
> use en_GB as a backup instead of the default en_US?

gettext allows to specify fallback languages:

http://www.gnu.org/software/gettext/manual/gettext.html#The-LANGUAGE-variable

Actually, I dont know if this works for your situation.

Conceptionally, you want some kind of overlay. You could do this
by a little script, which compiles several locales to a "virtual"
one, eg. by creating symlinks or compiling to new .po files
using msmerge:

http://www.gnu.org/software/gettext/manual/gettext.html#Updating

BUT: these files would become dynamic data, which is not handled
(eg. automatic removed on uninstall) by portage.


cu
--
---------------------------------------------------------------------
Enrico Weigelt == metux IT service - http://www.metux.de/
---------------------------------------------------------------------
Please visit the OpenSource QM Taskforce:
http://wiki.metux.de/public/OpenSource_QM_Taskforce
Patches / Fixes for a lot dozens of packages in dozens of versions:
http://patches.metux.de/
---------------------------------------------------------------------
 
Old 06-26-2010, 10:40 AM
Mick
 
Default Questions regarding the usage of multiple locales

On Tuesday 22 June 2010 17:14:13 Christopher Swift wrote:
> Ar Maw, 2010-06-22 am 14:38 +0100, ysgrifennodd Mick:
> > I'm also interested in this - although my question is probably simpler:
> >
> > I would like to use en_GB but I do not undestand why running 'locale'
> > as a plain user shows:
> >
> > $ locale
> > LANG=en_US.UTF-8
> > LC_CTYPE="en_US.UTF-8"
> > LC_NUMERIC="en_US.UTF-8"
> > LC_TIME="en_US.UTF-8"
> > LC_COLLATE="en_US.UTF-8"
> > LC_MONETARY="en_US.UTF-8"
> > LC_MESSAGES="en_US.UTF-8"
> > LC_PAPER="en_US.UTF-8"
> > LC_NAME="en_US.UTF-8"
> > LC_ADDRESS="en_US.UTF-8"
> > LC_TELEPHONE="en_US.UTF-8"
> > LC_MEASUREMENT="en_US.UTF-8"
> > LC_IDENTIFICATION="en_US.UTF-8"
> > LC_ALL=en_US.UTF-8
> >
> > why when running it as root:
> >
> > # locale
> > LANG=
> > LC_CTYPE="POSIX"
> > LC_NUMERIC="POSIX"
> > LC_TIME="POSIX"
> > LC_COLLATE="POSIX"
> > LC_MONETARY="POSIX"
> > LC_MESSAGES="POSIX"
> > LC_PAPER="POSIX"
> > LC_NAME="POSIX"
> > LC_ADDRESS="POSIX"
> > LC_TELEPHONE="POSIX"
> > LC_MEASUREMENT="POSIX"
> > LC_IDENTIFICATION="POSIX"
> > LC_ALL=
> >
> >
> > I do not have set a /etc/env.d/02locale yet, so where is my plain user
> > locale being read from?
>
> Your plain user locale is usually read from ~/.bashrc, this can be set
> to en_GB by having the following lines:
> export LANG="en_GB.UTF-8"
> export LC_COLLATE="C"

I have not exported any locale in my ~/.bashrc, so should a plain user locale
reflect what's in /etc/env.d/02locale?

I added /etc/env.d/02locale as you show above, but my plain user still shows
all settings as "en_US.UTF-8" ... where is this US setting read from?

Thanks,

--
Regards,
Mick
 
Old 06-26-2010, 10:49 AM
Mick
 
Default Questions regarding the usage of multiple locales

On Saturday 26 June 2010 11:40:14 Mick wrote:
> On Tuesday 22 June 2010 17:14:13 Christopher Swift wrote:
> > Ar Maw, 2010-06-22 am 14:38 +0100, ysgrifennodd Mick:
> > > I'm also interested in this - although my question is probably simpler:
> > >
> > > I would like to use en_GB but I do not undestand why running 'locale'
> > > as a plain user shows:
> > >
> > > $ locale
> > > LANG=en_US.UTF-8
> > > LC_CTYPE="en_US.UTF-8"
> > > LC_NUMERIC="en_US.UTF-8"
> > > LC_TIME="en_US.UTF-8"
> > > LC_COLLATE="en_US.UTF-8"
> > > LC_MONETARY="en_US.UTF-8"
> > > LC_MESSAGES="en_US.UTF-8"
> > > LC_PAPER="en_US.UTF-8"
> > > LC_NAME="en_US.UTF-8"
> > > LC_ADDRESS="en_US.UTF-8"
> > > LC_TELEPHONE="en_US.UTF-8"
> > > LC_MEASUREMENT="en_US.UTF-8"
> > > LC_IDENTIFICATION="en_US.UTF-8"
> > > LC_ALL=en_US.UTF-8
> > >
> > > why when running it as root:
> > >
> > > # locale
> > > LANG=
> > > LC_CTYPE="POSIX"
> > > LC_NUMERIC="POSIX"
> > > LC_TIME="POSIX"
> > > LC_COLLATE="POSIX"
> > > LC_MONETARY="POSIX"
> > > LC_MESSAGES="POSIX"
> > > LC_PAPER="POSIX"
> > > LC_NAME="POSIX"
> > > LC_ADDRESS="POSIX"
> > > LC_TELEPHONE="POSIX"
> > > LC_MEASUREMENT="POSIX"
> > > LC_IDENTIFICATION="POSIX"
> > > LC_ALL=
> > >
> > >
> > > I do not have set a /etc/env.d/02locale yet, so where is my plain user
> > > locale being read from?
> >
> > Your plain user locale is usually read from ~/.bashrc, this can be set
> > to en_GB by having the following lines:
> > export LANG="en_GB.UTF-8"
> > export LC_COLLATE="C"
>
> I have not exported any locale in my ~/.bashrc, so should a plain user
> locale reflect what's in /etc/env.d/02locale?
>
> I added /etc/env.d/02locale as you show above, but my plain user still
> shows all settings as "en_US.UTF-8" ... where is this US setting read
> from?

Oops! This is more complicated that I thought ...

If, always as a plain user, I use aterm then /etc/env.d/02locale is read and
LANG is en_GB.UTF-8. However, if I use xterm it is still LANG=en_US.UTF-8
--
Regards,
Mick
 
Old 06-26-2010, 11:10 AM
Alex Schuster
 
Default Questions regarding the usage of multiple locales

Mick writes:

> On Saturday 26 June 2010 11:40:14 Mick wrote:

> > I have not exported any locale in my ~/.bashrc, so should a plain
> > user locale reflect what's in /etc/env.d/02locale?
> >
> > I added /etc/env.d/02locale as you show above, but my plain user
> > still shows all settings as "en_US.UTF-8" ... where is this US
> > setting read from?
>
> Oops! This is more complicated that I thought ...
>
> If, always as a plain user, I use aterm then /etc/env.d/02locale is
> read and LANG is en_GB.UTF-8. However, if I use xterm it is still
> LANG=en_US.UTF-8

Your aterm is configured as a login shell, and as such reads /etc/profile,
which reads /etc/profile.env (and ~/.[bash]profile). xterm is not a login
shell, and reads /etc/bash/bashrc (and ~/.bashrc). You can call xterm with
the -ls option to make it alogin shell. For konsole, I have set it to
execute bash -l to make it a login shell.

Another workaround might be to read /etc/profile.env in your .bashrc, or
in /etc/bash/bashrc.

Wonko
 
Old 06-26-2010, 11:29 AM
Mick
 
Default Questions regarding the usage of multiple locales

On Saturday 26 June 2010 12:10:02 Alex Schuster wrote:
> Mick writes:

> > Oops! This is more complicated that I thought ...
> >
> > If, always as a plain user, I use aterm then /etc/env.d/02locale is
> > read and LANG is en_GB.UTF-8. However, if I use xterm it is still
> > LANG=en_US.UTF-8
>
> Your aterm is configured as a login shell, and as such reads /etc/profile,
> which reads /etc/profile.env (and ~/.[bash]profile). xterm is not a login
> shell, and reads /etc/bash/bashrc (and ~/.bashrc). You can call xterm with
> the -ls option to make it alogin shell. For konsole, I have set it to
> execute bash -l to make it a login shell.
>
> Another workaround might be to read /etc/profile.env in your .bashrc, or
> in /etc/bash/bashrc.

Hmm... I've added all this in my /etc/env.d/02locale:

LANG="en_GB.UTF-8"
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="C"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"

and in my ~/.bashrc

export LANG="en_GB.UTF-8"
export LC_CTYPE="en_GB.UTF-8"
export LC_NUMERIC="en_GB.UTF-8"
export LC_TIME="en_GB.UTF-8"
export LC_COLLATE="C"
export LC_MONETARY="en_GB.UTF-8"
export LC_MESSAGES="en_GB.UTF-8"
export LC_PAPER="en_GB.UTF-8"
export LC_NAME="en_GB.UTF-8"
export LC_ADDRESS="en_GB.UTF-8"
export LC_TELEPHONE="en_GB.UTF-8"
export LC_MEASUREMENT="en_GB.UTF-8"
export LC_IDENTIFICATION="en_GB.UTF-8"

but this is what aterm is showing:

$ locale
LANG=en_GB.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

There's no mention of LANG or LC_*US* in /etc/profile.env, /etc/bash/bashrc,
or anywhere else that I can see. So, where is it being read from?

PS. Not sure why LANG=en_GB.UTF-8 does not have " " marks like the LC_
parameters?
--
Regards,
Mick
 
Old 06-26-2010, 11:59 AM
Alex Schuster
 
Default Questions regarding the usage of multiple locales

Mick writes:

> On Saturday 26 June 2010 12:10:02 Alex Schuster wrote:

> > Your aterm is configured as a login shell, and as such reads

At least I thought so, what else could be the cause. But I just emerged
aterm, and the default is also to be not a login shell. There is a -ls
option for this, or the loginShell resource. Same as for xterm. So, there
should be no difference in those two shells. Maybe you started them with a
desktop shortcut that has extra options in it?
When debugging such things, I modify the startup files and add statements
like '[[ $- == *i* ]] echo .bashrc', so I see which ones get read. The [[
]] stuff makes this happen in interactive shells, so scripts are not
confused by the text output.

When starting one terminal from inside another, environment variables will
be

> > /etc/profile, which reads /etc/profile.env (and ~/.[bash]profile).
> > xterm is not a login shell, and reads /etc/bash/bashrc (and
> > ~/.bashrc). You can call xterm with the -ls option to make it
> > alogin shell. For konsole, I have set it to execute bash -l to make
> > it a login shell.
> >
> > Another workaround might be to read /etc/profile.env in your .bashrc,
> > or in /etc/bash/bashrc.
>
> Hmm... I've added all this in my /etc/env.d/02locale:
>
> LANG="en_GB.UTF-8"
> LC_CTYPE="en_GB.UTF-8"
[...]
>
> and in my ~/.bashrc
>
> export LANG="en_GB.UTF-8"
> export LC_CTYPE="en_GB.UTF-8"
[...]
>
> but this is what aterm is showing:
>
> $ locale
> LANG=en_GB.UTF-8
> LC_CTYPE="en_US.UTF-8"
[...]
> LC_ALL=en_US.UTF-8

Still looks like login shell behaviour, or else ~/.bashrc should have been
read.

> There's no mention of LANG or LC_*US* in /etc/profile.env,

Did you run env-update.sh? This puts all the stuff in /etc/env.d/ into
/ect/profile.env.

> /etc/bash/bashrc, or anywhere else that I can see. So, where is it
> being read from?

Hmm. Does grep -r LC_ALL /etc find something?


> PS. Not sure why LANG=en_GB.UTF-8 does not have " " marks like the LC_
> parameters?

Seems to be normal behaviour of the locale command.

Sorry, I don't know what's going on there.

Wonko
 
Old 06-26-2010, 12:20 PM
William Kenworthy
 
Default Questions regarding the usage of multiple locales

On Sat, 2010-06-26 at 13:59 +0200, Alex Schuster wrote:
> Mick writes:
>
> > On Saturday 26 June 2010 12:10:02 Alex Schuster wrote:
>
> > > Your aterm is configured as a login shell, and as such reads
>

You might want to read this and set up your locales properly.

http://www.gentoo.org/doc/en/guide-localization.xml

BillK
 

Thread Tools




All times are GMT. The time now is 06:40 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org