Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to define LINGUAS and "locale.gen" to specific programs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
pd1986
Guru
Guru


Joined: 19 Feb 2012
Posts: 404
Location: Paris

PostPosted: Tue May 29, 2012 9:42 am    Post subject: How to define LINGUAS and "locale.gen" to specific Reply with quote

Hello,

I would like to know if we can define LINGUAS and locale.gen for some specific programmes, like what we do in 'package.use'

In some programmes like libreoffice, I sometimes write French context. As far as I know, I need to define
Quote:
fr_FR ISO-8859-1
fr_FR@euro ISO-8859-15

in /etc/locale.gen, and
Quote:
LINGUAS="en fr"

in make.conf
especially for some letters with accent and deadkey,

But I am aware of that if I do this, when I emerge some program, it installed all the files to support French, of which I may not really need many. I only need the system can show French and I can write French in some specific program. I don't want to see all related to French emerged.

For example,
I don't need man page in French.
when I emerge smplayer, it indicate that it will use LINGUAS="en fr". But I'm not sure French support is necessary for me in smplayer.

However, it's necessary that the system can show French correctly and everywhere, as I have files in French with the name in French too, like word files and pdf files, I read some news in French by my Browser, etc.

So my question is:
Could we define LINGUAS and locale.gen only for some specific programmes, like what we do in 'package.use'? I don't know how much space they will take by adding French support. But if I can do this, it will be very pleasant.

Thanks
Back to top
View user's profile Send private message
xming
Guru
Guru


Joined: 02 Jul 2002
Posts: 441

PostPosted: Tue May 29, 2012 10:04 am    Post subject: Reply with quote

yes, you just need to expand it like this to put in the package.use
Code:

linguas_fr

_________________
http://wojia.be
Back to top
View user's profile Send private message
popsUlfr
Tux's lil' helper
Tux's lil' helper


Joined: 27 Feb 2011
Posts: 80

PostPosted: Tue May 29, 2012 10:12 am    Post subject: Reply with quote

Hi! There are several ways to do this: you said you only wanted specific programs to use french.
Globally you may only enable english linguas then:
Code:
LINGUAS="en"

in your /etc/make.conf.

I'll take firefox as example here.

The package.use way:
In your '/etc/portage/package.use' file or directory add the package you want to have support for the french language
Code:
www-client/firefox linguas_fr

This is the correct use expansion, for variables defined in your make.conf.

The env & package.env way:
If not already created, mkdir the '/etc/portage/env' directory.
In it add a file for instance 'neededlinguas.conf' with this content:
Code:
LINGUAS="${LINGUAS} fr"

(the ${LINGUAS} will inherit the already set LINGUAS in your make.conf)
Now create or open '/etc/portage/package.env'
In it add an entry like this
Code:
www-client/firefox neededlinguas.conf

The advantage is that you can now easily add or delete packages you wish to have french support for in this file just by appending the respective *.conf file in '/etc/portage/env'

Another option would be to create a configuration file directly in /etc/portage/env like this:
Code:
mkdir /etc/portage/env/www-client
echo 'LINGUAS="${LINGUAS} fr"' >> /etc/portage/env/www-client/firefox


But in my opinion the package.env way is the more elegant solution.

Hope this helps.
Back to top
View user's profile Send private message
pd1986
Guru
Guru


Joined: 19 Feb 2012
Posts: 404
Location: Paris

PostPosted: Tue May 29, 2012 12:23 pm    Post subject: Reply with quote

popsUlfr wrote:
Hi! There are several ways to do this: you said you only wanted specific programs to use french.
Globally you may only enable english linguas then:
Code:
LINGUAS="en"

in your /etc/make.conf.

I'll take firefox as example here.

The package.use way:
In your '/etc/portage/package.use' file or directory add the package you want to have support for the french language
Code:
www-client/firefox linguas_fr

This is the correct use expansion, for variables defined in your make.conf.

The env & package.env way:
If not already created, mkdir the '/etc/portage/env' directory.
In it add a file for instance 'neededlinguas.conf' with this content:
Code:
LINGUAS="${LINGUAS} fr"

(the ${LINGUAS} will inherit the already set LINGUAS in your make.conf)
Now create or open '/etc/portage/package.env'
In it add an entry like this
Code:
www-client/firefox neededlinguas.conf

The advantage is that you can now easily add or delete packages you wish to have french support for in this file just by appending the respective *.conf file in '/etc/portage/env'

Another option would be to create a configuration file directly in /etc/portage/env like this:
Code:
mkdir /etc/portage/env/www-client
echo 'LINGUAS="${LINGUAS} fr"' >> /etc/portage/env/www-client/firefox


But in my opinion the package.env way is the more elegant solution.

Hope this helps.


Thanks. It's OK for linguas.
And for locale.gen? I need to keep fr to show French everywhere, such in terminal, in desktop environment? I'm given an understanding that language used in man page depend on this configuration.
Back to top
View user's profile Send private message
pd1986
Guru
Guru


Joined: 19 Feb 2012
Posts: 404
Location: Paris

PostPosted: Tue May 29, 2012 12:24 pm    Post subject: Reply with quote

xming wrote:
yes, you just need to expand it like this to put in the package.use
Code:

linguas_fr


Thanks. It's OK for linguas.
And for locale.gen? I need to keep fr to show French everywhere, such in terminal, in desktop environment? I'm given an understanding that language used in man page depend on this configuration.
Back to top
View user's profile Send private message
pd1986
Guru
Guru


Joined: 19 Feb 2012
Posts: 404
Location: Paris

PostPosted: Tue May 29, 2012 12:29 pm    Post subject: Reply with quote

Sorry, man page depends on linguas
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Tue May 29, 2012 1:42 pm    Post subject: Reply with quote

Sorry to interfere here, but the given information is not correct (unless portage does some undocumented magic concerning LINGUAS):

Unfortunately, LINGUAS has a duplicate meaning: On the one hand, it is used as a USE_EXPAND-variable to set the USE-Flags linguas_.... appropriately.
On the other hand, LINGUAS is directly used by autotools (and perhaps also other build systems) to decide which translations to install.

So modifying the USE-variables (either in make.conf or in /etc/portage/package.use) will only affect the USE-Flags, but not the build system directly.
(Note also that many packages supporting several languages do not make use of USE=linguas_... USE-flags; as a rule, only those packages use this USE-flags which have to download different files depending on the linguas - all other packages only "tacitly" read the LINGUAS variable)

Thus, to get the full effect, you need to modify both locally: The USE-flags and the LINGUAS variable (e.g. in /etc/portage/package.env).

locale.gen is independent: You must have included the language here to use it at all. Namely, locale.gen is only used when you install glibc, and if glibc does not support your language, chances are almost zero that any program can support it.
Back to top
View user's profile Send private message
pd1986
Guru
Guru


Joined: 19 Feb 2012
Posts: 404
Location: Paris

PostPosted: Tue May 29, 2012 1:52 pm    Post subject: Reply with quote

mv wrote:
Sorry to interfere here, but the given information is not correct (unless portage does some undocumented magic concerning LINGUAS):

Unfortunately, LINGUAS has a duplicate meaning: On the one hand, it is used as a USE_EXPAND-variable to set the USE-Flags linguas_.... appropriately.
On the other hand, LINGUAS is directly used by autotools (and perhaps also other build systems) to decide which translations to install.

So modifying the USE-variables (either in make.conf or in /etc/portage/package.use) will only affect the USE-Flags, but not the build system directly.
(Note also that many packages supporting several languages do not make use of USE=linguas_... USE-flags; as a rule, only those packages use this USE-flags which have to download different files depending on the linguas - all other packages only "tacitly" read the LINGUAS variable)

Thus, to get the full effect, you need to modify both locally: The USE-flags and the LINGUAS variable (e.g. in /etc/portage/package.env).

locale.gen is independent: You must have included the language here to use it at all. Namely, locale.gen is only used when you install glibc, and if glibc does not support your language, chances are almost zero that any program can support it.


Thank you very much.
So I'll keep locale.gen conf.
For not causing more issues, I'll keep the LINGUAS with "fr" too, and eliminate "fr" in the application where I don't need French support, for instance smplayer interface.

PS: Sorry to post this here. But I don't know where I should put this thread, this is the most related board I throught.
Back to top
View user's profile Send private message
popsUlfr
Tux's lil' helper
Tux's lil' helper


Joined: 27 Feb 2011
Posts: 80

PostPosted: Tue May 29, 2012 2:55 pm    Post subject: Reply with quote

mv wrote:
Sorry to interfere here, but the given information is not correct (unless portage does some undocumented magic concerning LINGUAS):

Unfortunately, LINGUAS has a duplicate meaning: On the one hand, it is used as a USE_EXPAND-variable to set the USE-Flags linguas_.... appropriately.
On the other hand, LINGUAS is directly used by autotools (and perhaps also other build systems) to decide which translations to install.

So modifying the USE-variables (either in make.conf or in /etc/portage/package.use) will only affect the USE-Flags, but not the build system directly.
(Note also that many packages supporting several languages do not make use of USE=linguas_... USE-flags; as a rule, only those packages use this USE-flags which have to download different files depending on the linguas - all other packages only "tacitly" read the LINGUAS variable)

Thus, to get the full effect, you need to modify both locally: The USE-flags and the LINGUAS variable (e.g. in /etc/portage/package.env).

locale.gen is independent: You must have included the language here to use it at all. Namely, locale.gen is only used when you install glibc, and if glibc does not support your language, chances are almost zero that any program can support it.


Thank you for the information! Just one thing that isn't too clear for me: if you change the LINGUAS variable why do you need to also change the use flag (e.g.: linguas_fr)? I always ever change my LINGUAS variable and portage picks up the use flags just fine...
Back to top
View user's profile Send private message
pd1986
Guru
Guru


Joined: 19 Feb 2012
Posts: 404
Location: Paris

PostPosted: Tue May 29, 2012 3:16 pm    Post subject: Reply with quote

popsUlfr wrote:
mv wrote:
Sorry to interfere here, but the given information is not correct (unless portage does some undocumented magic concerning LINGUAS):

Unfortunately, LINGUAS has a duplicate meaning: On the one hand, it is used as a USE_EXPAND-variable to set the USE-Flags linguas_.... appropriately.
On the other hand, LINGUAS is directly used by autotools (and perhaps also other build systems) to decide which translations to install.

So modifying the USE-variables (either in make.conf or in /etc/portage/package.use) will only affect the USE-Flags, but not the build system directly.
(Note also that many packages supporting several languages do not make use of USE=linguas_... USE-flags; as a rule, only those packages use this USE-flags which have to download different files depending on the linguas - all other packages only "tacitly" read the LINGUAS variable)

Thus, to get the full effect, you need to modify both locally: The USE-flags and the LINGUAS variable (e.g. in /etc/portage/package.env).

locale.gen is independent: You must have included the language here to use it at all. Namely, locale.gen is only used when you install glibc, and if glibc does not support your language, chances are almost zero that any program can support it.


Thank you for the information! Just one thing that isn't too clear for me: if you change the LINGUAS variable why do you need to also change the use flag (e.g.: linguas_fr)? I always ever change my LINGUAS variable and portage picks up the use flags just fine...


Yeah, same question. I've just done the configuration.

PS: I finally decided to do the opposite way, which is put LINGUAS="en" and add the programme which I need in portage.env.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Tue May 29, 2012 5:22 pm    Post subject: Reply with quote

popsUlfr wrote:
Thank you for the information! Just one thing that isn't too clear for me: if you change the LINGUAS variable why do you need to also change the use flag (e.g.: linguas_fr)? I always ever change my LINGUAS variable and portage picks up the use flags just fine...

Maybe it can work with /etc/portage/package.env, because portage parses this on the python level. However, it is not so clear (and probably not guaranteed in any way) that this happens early enough. It is similar to changing USE in /etc/portage/package.env: This can only have effect if portage checks these files even already during dependency resolution, because the dependency tree might change if the USE-flags change. I guess that you can get the wrong dependency tree in some cases if you do not use /etc/portage/package.use.
Back to top
View user's profile Send private message
popsUlfr
Tux's lil' helper
Tux's lil' helper


Joined: 27 Feb 2011
Posts: 80

PostPosted: Tue May 29, 2012 7:02 pm    Post subject: Reply with quote

mv wrote:
Maybe it can work with /etc/portage/package.env, because portage parses this on the python level. However, it is not so clear (and probably not guaranteed in any way) that this happens early enough. It is similar to changing USE in /etc/portage/package.env: This can only have effect if portage checks these files even already during dependency resolution, because the dependency tree might change if the USE-flags change. I guess that you can get the wrong dependency tree in some cases if you do not use /etc/portage/package.use.


Alright, I see your point. I just did some tests myself and it's really not guaranteed in which order the files and variables are parsed.
Thank you :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum