Re: N_() and _()
- From: Pablo Saratxaga <pablo mandrakesoft com>
- To: gnome-list gnome org
- Subject: Re: N_() and _()
- Date: Fri, 29 Oct 1999 11:36:47 +0200
Kaixo!
On Thu, Oct 28, 1999 at 11:16:47AM +0200, Andreas Buesching wrote:
> > If it still isn't that, tell me whihc file it is if it is on the CVS; or
> > send me the *.c file and the po/Makefile.
>
> Here they are
I haven'"t had any problem, with those, to create the *.pot file;
and make update-po updated de.po (it was just empty before, and full
after:) )
However I see something:
> Makefile
> POFILES = de.po fr.po
> GMOFILES = de.gmo fr.gmo
...
> CATALOGS = de.gmo
Is that on purpose that you only compile german files ?
If not you should undefine the LINGUAS variable; otherwise only languages
defined in that variable will be handled. A developper should NEVER define
that variable when working on his own programs or when doing packaging;
as that will leave out the other languages.
In particular when you do 'make update-po' only the german de.po file
will be updated:
> update-po: Makefile
> $(MAKE) $(PACKAGE).pot
> PATH=`pwd`/../src:$$PATH; \
> cd $(srcdir); \
> catalogs='$(CATALOGS)'; \
> for cat in $$catalogs; do \
for ... in $(CATALOGS) and it only contains the German file.
So, undefine your LINGUAS variable and re-run ./configure
Another thing; in your *.c file:
> #define TOOLTIP_TYPE_SMALL N_("x/y mailboxes contain new mail")
> #define TOOLTIP_TYPE_MIDDLE N_("sorted by priorities")
> #define TOOLTIP_TYPE_LARGE N_("each mailbox separate")
> #define TOOLTIP_TYPE_NEW_MAIL N_("each mailbox with new mail")
etc.
xgettext never sees strings on #define lines.
It would be better to use either global variables; either a place holder
that is never compiled; eg:
#define TOOLTIP_TYPE_SMALL _("x/y mailboxes contain new mail")
#define TOOLTIP_TYPE_MIDDLE _("sorted by priorities")
#define TOOLTIP_TYPE_LARGE _("each mailbox separate")
#define TOOLTIP_TYPE_NEW_MAIL _("each mailbox with new mail")
#if 0
/* this is a placeholder for some strings so that xgettext can see them */
char *placeholder[] = {
N_("x/y mailboxes contain new mail"),
N_("sorted by priorities"),
N_("each mailbox separate"),
N_("each mailbox with new mail"),
};
#endif
Maybe xgettext() will be fixed some day to be able to scan define lines
too; but it doesn't do yet so we have to cheat.
And while I'm at giving advices: never, ever, ever 'translate' an empty
string ! doing something like that:
printf( _("") );
will show not an empty string, but something like:
"Project-Id-Version: xmms 0.9.1\n"
"POT-Creation-Date: 1999-07-20 17:26+0200\n"
"PO-Revision-Date: 1999-06-14 01:14+0200\n"
"Last-Translator: Pablo Saratxaga <srtxg@chanae.alphanet.ch>\n"
"Language-Team: walon <linux-wa@chanae.alphanet.ch>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
(that is the header of the po file for the user's language).
And if you use some generic translation that may apply to empty strings,
you must check them; eg:
printf( _(somevar[i]) );
is potentially dangerous if for some values of i somevar[i] can be an empty
string. In such case do something like:
printf( *(somevar[i]) ? _(somevar[i]) : "" );
so if the variable has at least one char it can be translated, if it is empty
just return an empty string ""
--
Ki ça vos våye bén,
Pablo Saratxaga
http://www.ping.be/~pin19314/ PGP Key available, key ID: 0x8F0E4975
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]