On Sat, Oct 22, 2005 at 09:02:28PM +0200, Marc Haber wrote:
> > Of course this comment may be improved ;)
> > You need to call xgettext with the -c flag so that comments are
> > inserted
> > into PO files.
> 
> that would be XGETTEXT = xgettext -c in po/Makefile, right? Done.

Hmmm, I prefer adding -c after $(XGETTEXT).

There is another glitch with po/Makefile:
 adduser-3.76/po$ touch ../adduser
 adduser-3.76/po$ make adduser.pot
 xgettext -c -L Perl -kgtx -o adduser.pot ../adduser
Strings from deluser are then discarded.  Patch attached.

> > Other minor i18n problems with your package:
> >  * the gtx() function is useless and confuses xgettext
> 
> gtx was named _ previously and is obviously modeled after the _ macro
> suggested in the gettext texinfo documentation. I'd like to keep it to
> be able to disable i18n for testing and debugging purposes.
> Unfortunately, it cannot be named _ as File::Find starts to behave
> very strangely when a function called _ is in the namespace.
> 
> Is it possible to overload gettext with a no-op for testing purposes?
> If so, your changes are acceptable. I'd like to have gettext in a
> state where it can be disabled.
>
> Can't xgettexts confusion be remedied by replacing -k_ with -kgtx in
> the Makefile? I have tried this in the lastest upload to experimental,
> please verify.

Yes, but xgettext still displays a warning.
In AdduserCommon.pm, you can replace
  sub gtx {
      return gettext( join "", @_);
  }
by
  sub gtx {
      return gettext(shift):
  }
to remove this warning.  Calling gtx with a list is wrong, because
only the first string is extracted into the POT file (see the attached
patch, the 2nd string from deluser is not in adduser.pot).

> > Here is a patch.  I tested it, but of course it may introduce bugs,
> > please review it carefully ;)
> 
> I applied the changes, but left gtx intact. Please reconsider this
> suggestion.

Frankly, I see no reason to keep this wrapper.  If you do not want
localized messages, run your scripts with LC_ALL=C.

> > s_print (gtx("Backing up files to be removed to ". $config{"backup_to"}. " 
> > ...\n"));
> 
> Doesn't this cause translation pain as well?

Absolutely, I missed this one.

> I have changed it to
> 
> s_printf (gtx("Backing up files to be removed to %s 
> ...\n"),$config{"backup_to"});

Thanks.

Denis
diff -ur adduser-3.76.old/AdduserCommon.pm adduser-3.76/AdduserCommon.pm
--- adduser-3.76.old/AdduserCommon.pm   2005-10-18 16:20:00.000000000 +0200
+++ adduser-3.76/AdduserCommon.pm       2005-10-24 23:22:57.000000000 +0200
@@ -56,8 +56,8 @@
       }
 }
 
-sub gtx {
-    return gettext( join "", @_);
+sub gtx ($) {
+    return gettext(shift);
 }
 
 sub dief {
diff -ur adduser-3.76.old/deluser adduser-3.76/deluser
--- adduser-3.76.old/deluser    2005-10-22 20:54:53.000000000 +0200
+++ adduser-3.76/deluser        2005-10-24 23:32:46.000000000 +0200
@@ -397,7 +397,7 @@
 
     printf gtx("Copyright (C) 2000 Roland Bauerschmidt <[EMAIL 
PROTECTED]>\n\n");
 
-    printf gtx("deluser is based on adduser by Guy Maor <[EMAIL PROTECTED]>, 
Ian Murdock\n",
+    printf gtx("deluser is based on adduser by Guy Maor <[EMAIL PROTECTED]>, 
Ian Murdock\n".
          "<[EMAIL PROTECTED]> and Ted Hajek <[EMAIL PROTECTED]>\n");
 
     printf gtx("\nThis program is free software; you can redistribute it 
and/or modify
diff -ur adduser-3.76.old/po/Makefile adduser-3.76/po/Makefile
--- adduser-3.76.old/po/Makefile        2005-10-22 21:08:37.000000000 +0200
+++ adduser-3.76/po/Makefile    2005-10-24 23:35:29.000000000 +0200
@@ -1,4 +1,4 @@
-XGETTEXT = xgettext -c
+XGETTEXT = xgettext
 MSGFMT = msgfmt
 MSGMERGE = msgmerge
 
@@ -12,6 +12,7 @@
 PO = $(wildcard *.po)
 LANG = $(basename $(PO))
 MO = $(addsuffix .mo,$(LANG))
+SOURCES = ../adduser ../deluser ../AdduserCommon.pm
 
 all: update $(MO)
 update: adduser.pot
@@ -20,8 +21,8 @@
        $(MSGMERGE) -U $$po adduser.pot; \
        done;
 
-adduser.pot: ../adduser ../deluser ../AdduserCommon.pm
-       $(XGETTEXT) -L Perl -kgtx -o $@ $?
+adduser.pot: $(SOURCES)
+       $(XGETTEXT) -c -L Perl -kgtx -o $@ $(SOURCES)
 
 install: all
        for i in $(MO) ; do \

Reply via email to