Date: Tue, 2 Mar 2004 13:17:49 +0000 From: Eivind Eklund <eivind@FreeBSD.org> To: Kris Kennaway <kris@obsecurity.org> Cc: ports-committers@FreeBSD.org Subject: Re: Gettext issues (was Re: cvs commit: ports CHANGES) Message-ID: <20040302131749.GG27008@FreeBSD.org> In-Reply-To: <20040302035808.GA1535@xor.obsecurity.org> References: <200402040638.i146cVAi035977@repoman.freebsd.org> <20040229233524.GA48293@dragon.nuxi.com> <1078098236.62463.50.camel@shumai.marcuscom.com> <20040301104026.GC27008@FreeBSD.org> <20040301115006.GA64348@xor.obsecurity.org> <20040301154440.GC71640@dragon.nuxi.com> <20040301162624.GE27008@FreeBSD.org> <20040302035808.GA1535@xor.obsecurity.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 01, 2004 at 07:58:08PM -0800, Kris Kennaway wrote:
> On Mon, Mar 01, 2004 at 04:26:24PM +0000, Eivind Eklund wrote:
>
> > The knob is there for a number of ports (but much fewer than I had
> > thought - I actually thought it was fairly universal):
> >
> > devel/bison/Makefile
> > devel/gmake/Makefile
> > ftp/wget/Makefile
> > mail/mutt-devel/Makefile
> > mail/mutt/Makefile
> > net/darkstat/Makefile
> >
> > This has actually seemed to be enough to stop most of the problems I
> > have with gettext (which shows you what kind of programs I run ;)
> >
> > I think we should try to have it become universal - getting rid of
> > gettext is very useful for most of us.
>
> I successfully removed gettext from a number of my installed ports,
> but it looks like glib20 and everything that depends on it absolutely
> requires gettext (there's a note in the ChangeLog suggesting that it
> was a design decision). That means pretty much everything GNOME and
> KDE requires it, but it's still a step forward to proceed with other
> ports.
Looking at the code, I think you're wrong - it just autodetect. Or at
least the code autodetect and contain ifdef's on ENABLE_NLS to
enable/disable code sections based on whether NLS is available or not.
For the more general case: I think we can use a dummy gettext library to
get around things needing gettext. The gettext calls generally index on
the english string, making a dummy implementation very easy.
Below is an implementation (not tested) which should compliant with the basic
interface, and hopefully work. A better variant might be actually have
all of this defined as inline functions in a header.
The docs I've found are at
http://www.scit.wlv.ac.uk/cgi-bin/mansec?3C+gettext
and
http://www.gnu.org/software/gettext/manual/html_node/gettext_145.html#SEC145
Eivind.
>>> gettext.h:
char *textdomain (const char *domain_name);
char *gettext(const char *msgid);
char *dgettext(const char *domain_name, const char *msgid);
char *dcgettext(const char *domain_name, const char *msgid, int category);
char *bindtextdomain (const char *domain_name, const char *dir_name);
>>> gettext.c:
char *
textdomain(const char *domain_name)
{
return domain_name ? NULL : "messages";
}
char *
gettext(const char *msgid)
{
return msgid;
}
char *
dgettext(const char *domain_name, const char *msgid) {
return msgid;
}
char *
dcgettext(const char *domain_name, const char *msgid, int category) {
return msgid;
}
char *
bindtextdomain(const char *domain_name, const char *dir_name) {
if (domain_name == NULL || strcmp(domain_name, "") == 0) {
return NULL;
} else {
return "messages";
}
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040302131749.GG27008>
