Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Understanding the LINGUAS variable and use-expand
Date: Fri, 24 Feb 2012 16:38:13
Message-Id: CAJ0EP40pan8dD1gqot59Ji32Ec6GMKVP71J=-gSBAD0rdjV-4w@mail.gmail.com
In Reply to: Re: [gentoo-dev] Understanding the LINGUAS variable and use-expand by Mart Raudsepp
1 On Wed, Feb 8, 2012 at 12:04 PM, Mart Raudsepp <leio@g.o> wrote:
2 > On K, 2012-02-08 at 11:32 -0500, Mike Gilbert wrote:
3 >> I am considering simplifying www-client/chromium from the current mess
4 >> based on the linguas USE flags to basically just this:
5 >>
6 >> if [[ ${LINGUAS} ]]; then
7 >>   for x in *.pak; do
8 >>     mylang=${x%.pak}
9 >>     mylang=%{x/-/_}
10 >>     has $mylang $LINGUAS || rm $x
11 >>   done
12 >> fi
13
14 > I think users could be surprised a bit about cases where you have
15 > variants or dialects, e.g currently as IUSE=linguas_fr_FR, when users
16 > only have LINGUAS=fr - in gettext they often don't have a fr_FR.po, just
17 > fr.po; if locale has LC_MESSAGE and LANG at fr_FR, it will look at "fr"
18 > if more specific fr_FR not found.
19 > I define things like LINGUAS="en en_US et et_EE" to be really sure, but
20 > I doubt many users do that (but that's just a guess).
21 > If it's exposed via IUSE, then they can at least have some visual cue of
22 > that.
23 > I guess it wouldn't be a concern if we had a tool to set the LINGUAS
24 > that handled this variant logic nicely, or just educating users in
25 > documentation, make.conf.example comments and so on.
26
27 Thanks for catching that Mart. I think I have addressed the dialect
28 issue by more directly emulating the autoconf macro. See below.
29
30 I would greatly appreciate any additional feedback anyone has on this subject.
31
32
33 New code, currently used (experimentally) in
34 google-chrome-19.0.1049.3_alpha123257.ebuild:
35
36 if [[ "%UNSET%" != "${LINGUAS-%UNSET}" ]]; then
37 local found desiredlang presentlang pak pakname
38
39 pushd "${CHROME_HOME}locales" > /dev/null || die
40
41 for pak in *.pak; do
42 pakname="${pak%.pak}"
43 pakname="${pakname/-/_}"
44 presentlang="$(chromium_lang "${pakname}")"
45
46 # Do not issue warning for en_US locale. This is the fallback
47 # locale so it should always be installed.
48 if [[ "${presentlang}" == "en_US" ]]; then
49 continue
50 fi
51
52 found=
53 for desiredlang in ${LINGUAS}; do
54 if [[ "${desiredlang}" == "${presentlang}"* ]]; then
55 found=1
56 break
57 fi
58 done
59
60 if [[ -z ${found} ]]; then
61 rm "${pak}" || die
62 fi
63 done
64
65 popd > /dev/null
66 fi