Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 190842 Details for
Bug 269262
[devmanual] LINGUAS section
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
general-concepts/linguas/text.xml
text.xml (text/plain), 3.77 KB, created by
Mounir Lamouri (volkmar) (RETIRED)
on 2009-05-10 13:59:50 UTC
(
hide
)
Description:
general-concepts/linguas/text.xml
Filename:
MIME Type:
Creator:
Mounir Lamouri (volkmar) (RETIRED)
Created:
2009-05-10 13:59:50 UTC
Size:
3.77 KB
patch
obsolete
><?xml version="1.0"?> ><guide self="general-concepts/linguas/"> ><chapter> ><title>Linguas</title> > ><body> > ><p> >This feature lets the user to specify the desired languages he wants to be installed for his system and for specific packages. This feature is used with the <c>LINGUAS</c> variable which can be specified in <c>/etc/make.conf</c>. ></p> > ><subsection> ><title>NLS and dependencies</title> ><body> > ><p> >Packages supporting <c>LINGUAS</c> are generally using a nls <c>USE</c> flag or at least used nls. nls <c>USE</c> flag oftenly needs sys-devel/gettext and dev-util/intltool as a <c>DEPEND</c>. ></p> > ></body> ></subsection> > ><subsection> ><title>Managing the LINGUAS variable</title> ><body> > ><p> >To use <c>LINGUAS</c> variable specified in <c>/etc/make.conf</c> in ebuilds, specifics <c>USE</c> flags have to be added in <c>IUSE</c> variable. These <c>USE</c> flags have to begin with <c>linguas_</c> followed by a <c>LANG</c> code. <c>LANG</c> codes are beginning with a two-letter language code optionnaly followed with an underscore and a two-letter country code. For example, <c>USE</c> flag for british english will be <c>en_GB</c>. ></p> > ><p> >Generally, this is managed with a <c>IUSE_LINGUAS</c> variable wich is used to add right <c>USE</c> flags in <c>IUSE</c> variable like this: ></p> > ><codesample lang="ebuild"> >IUSE_LINGUAS="en_US en_GB es fr ja sv pt_BR hu ru" > >for l in ${IUSE_LINGUAS}; do > IUSE="${IUSE} linguas_${l}" >done ></codesample> > ><p> >This have to be set after <c>IUSE</c> definition and can be done after classic viarable definitions to make it clearer. This oftenly means after <c>DEPEND</c> and <c>RDEPEND</c>. ></p> > ><p> >At this point, users will be able to see which <c>LINGUAS</c> are supported and used for the ebuild and he will be able to custom that to feet his needs. ></p> > ><p> ><c>strip-linguas</c> function for <c>eutils</c> eclass will help to set a variable containing all enabled languages. It needs a parameter containing a all supported <c>LINGUAS</c>. It has to be used in <c>pkg_setup</c>. Using the previous example, it will be: ></p> > ><codesample lang="ebuild"> >strip-linguas ${IUSE_LINGUAS} ></codesample> > ><p> >This function will modify <c>LINGUAS</c> variable and if no supported languages have been enabled, the variable will be unset. Depending on packages, unset <c>LINGUAS</c> variable will enable all languages or use a default one. Mostly, en. So you probably should test that to have a known default behaviour. Like this: ></p> > ><codesample lang="ebuild"> >if [[ -z "${LINGUAS}" ]]; then > # no linguas set, using the default one > LINGUAS=" " >fi ></codesample> > ><p> >or ></p> > ><codesample lang="ebuild"> >if [[ -z "${LINGUAS}" ]]; then > # no linguas set, using en_US > LINGUAS="en_US" >fi ></codesample> > ><p> >This can also be followed by a warning. ></p> > ><p> > Most packages are using <c>LINGUAS</c> variable but some others are using specific variable like <c>app-office/openoffice</c>. In these cases, you will have to export the desired variable. Some packages also need the variable to be passed via the configure script. ></p> > ><codesample lang="ebuild"> ># in pkg_setup >export MY_LINGUAS=${LINGUAS} > ># in src_configure >econf --with-lang=${MY_LINGUAS} ></codesample> > ></body> ></subsection> > ><subsection> ><title>Summarizing example</title> ><body> > ><codesample lang="ebuild"> >inherit eutils > >DESCRIPTION="This is an example" >HOMEPAGE="http://www.gentoo.org/" >SRC_URI="" > >LICENSE="GPL-2" >SLOT="0" >KEYWORDS="" >IUSE="nls" > >RDEPEND="" >DEPEND="${RDEPEND} > nls? ( dev-util/intltool > sys-devel/gettext )" > >IUSE_LINGUAS="en_US en_GB es fr ja sv pt_BR hu ru" > >for l in ${IUSE_LINGUAS}; do > IUSE="${IUSE} linguas_${l}" >done > >pkg_setup() { > strip-linguas ${IUSE_LINGUAS} > > if [[ -z "${LINGUAS}" ]]; then > # no linguas set, using the default one > LINGUAS=" " > fi >} ></codesample> > ></body> ></subsection> > ></body> ></chapter> ></guide>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 269262
: 190842