On Fri, Oct 21, 2005 at 09:23:36AM +0200, Marc Haber wrote:
> On Fri, Oct 21, 2005 at 08:36:10AM +0200, Christian Perrier wrote:
> > (Marc pinged me on IRC about this bug report in adduser)
> 
> Thanks for your help!
> 
> > First of all, I think that adduser should probably make better use of
> > the locales information for this Yes/No answer.
> 
> I think that would be a good idea here.
> 
> > I don't have the required skills to lead you to the solution, Marc,
> > but I think that Denis Barbier could.
> 
> Thanks for directly Ccing him, I hope that he can find the time to help.
> 
> > This fr.po file for adduser is under work now and you should soon have
> > a new version anyway with these fixes among others.
> 
> OK, I'll wait for that before applying stuff. Better not mess with
> things that I don't understand.

Hi,

There is very good documentation in libc.info, section "Yes-or-No Questions",
but unfortunately it is not relevant here because adduser is a perl script.
So I had a look at perllocale(1), which has some nice tips, in particular
about I18N::Langinfo.  But be warned that their example is not very
valuable under GNU/Linux, because glibc introduced YESSTR/NOSTR lately
and many locales do not provide them.  On the other hand, they all
provide YESEXPR/NOEXPR, so you can run something like:
  use I18N::Langinfo qw(langinfo YESEXPR);
  my $yesexpr = langinfo(YESEXPR());
  for (;;) {
    &systemcall('/usr/bin/chfn', $new_name);
    #  Translators: [y/N] has to be replaced by values defined in your
    #  locale.  You can see by running "locale yesexpr" which regular
    #  expression will be checked to find positive answer.
    print (gtx("Is the information correct? [y/N] "));
    chop ($answer=<STDIN>);
    last if ($answer =~ m/$yesexpr/o);
  }

Of course this comment may be improved ;)
You need to call xgettext with the -c flag so that comments are inserted
into PO files.
Other minor i18n problems with your package:
 * the gtx() function is useless and confuses xgettext
 * Some msgid are concatenated to build a full sentence.  This is bad.
   and in this case only the first part was present in PO files.
Here is a patch.  I tested it, but of course it may introduce bugs,
please review it carefully ;)

Denis
diff -ur adduser-3.74.orig/AdduserCommon.pm adduser-3.74/AdduserCommon.pm
--- adduser-3.74.orig/AdduserCommon.pm  2005-10-18 16:20:00.000000000 +0200
+++ adduser-3.74/AdduserCommon.pm       2005-10-21 23:49:30.000000000 +0200
@@ -10,7 +10,7 @@
 #                     Ian A. Murdock <[EMAIL PROTECTED]>
 #
 
[EMAIL PROTECTED] = qw(invalidate_nscd gtx dief warnf read_config 
get_users_groups get_group_members s_print s_printf systemcall);
[EMAIL PROTECTED] = qw(invalidate_nscd dief warnf read_config get_users_groups 
get_group_members s_print s_printf systemcall);
 
 sub invalidate_nscd {
     # Check if we need to do make -C /var/yp for NIS
@@ -56,10 +56,6 @@
       }
 }
 
-sub gtx {
-    return gettext( join "", @_);
-}
-
 sub dief {
     my ($form,@argu)[EMAIL PROTECTED];
     printf STDERR "$0: $form",@argu;
@@ -80,7 +76,7 @@
     my ($var, $lcvar, $val);
 
     if (! -f $conf_file) {
-       printf gtx("%s: `%s' doesn't exist.  Using defaults.\n"),$0,$conf_file 
if $verbose;
+       printf gettext("%s: `%s' doesn't exist.  Using 
defaults.\n"),$0,$conf_file if $verbose;
        return;
     }
 
@@ -90,12 +86,12 @@
        next if /^#/ || /^\s*$/;
 
        if ((($var, $val) = /^\s*(\S+)\s*=\s*(.*)/) != 2) {
-           warnf gtx("Couldn't parse `%s':%s.\n"),$conf_file,$.;
+           warnf gettext("Couldn't parse `%s':%s.\n"),$conf_file,$.;
            next;
        }
        $lcvar = lc $var;
        if (!defined($configref->{$lcvar})) {
-           warnf gtx("Unknown variable `%s' at `%s':%s.\n"),$var,$conf_file,$.;
+           warnf gettext("Unknown variable `%s' at 
`%s':%s.\n"),$var,$conf_file,$.;
            next;
        }
 
diff -ur adduser-3.74.orig/adduser adduser-3.74/adduser
--- adduser-3.74.orig/adduser   2005-10-19 15:09:09.000000000 +0200
+++ adduser-3.74/adduser        2005-10-21 23:45:02.000000000 +0200
@@ -48,10 +48,19 @@
     if ($@) {
        *setlocale = sub { return 1 };
     }
+    eval {
+       require I18N::Langinfo;
+       import I18N::Langinfo qw(langinfo YESEXPR);
+    };
+    if ($@) {
+       *langinfo = sub { "^[yY]" };
+       *YESEXPR = sub { 1 };
+    }
 }
 
 setlocale(LC_MESSAGES, "");
 textdomain("adduser");
+my $yesexpr = langinfo(YESEXPR());
 
 our $verbose = 1;              # should we be verbose?
 my $allow_badname = 0;         # should we allow bad names?
@@ -86,7 +95,7 @@
            "debug" => \$debugging );
 
 # everyone can issue "--help" and "--version", but only root can go on
-die ("$0: ",gtx("Only root may add a user or group to the system.\n")) if ($> 
!= 0);
+die ("$0: ",gettext("Only root may add a user or group to the system.\n")) if 
($> != 0);
 
 if( defined($configfile) ) { @defaults = ($configfile); }
 
@@ -106,30 +115,30 @@
 
 while (defined($arg = shift(@ARGV))) {
   if (defined($names[0]) && $arg =~ /^--/) {
-      die ("$0: ",gtx("No options allowed after names.\n"))
+      die ("$0: ",gettext("No options allowed after names.\n"))
     } else {                   # it's a username
        push (@names, $arg);
     }
 }
 
-die ("$0: ",gtx("I need a name to add.\n")) if (length($names[0]) == 0);
-die ("$0: ",gtx("No more than two names.\n")) if (@names > 2);
+die ("$0: ",gettext("I need a name to add.\n")) if (length($names[0]) == 0);
+die ("$0: ",gettext("No more than two names.\n")) if (@names > 2);
            
 if (@names == 0) {
     if($found_group_opt || $action eq "addgroup" || $action eq "addsysgroup")
       {
-         print (gtx("Enter a groupname to add: "));
+         print (gettext("Enter a groupname to add: "));
       }
     else
       {
-         print (gtx("Enter a username to add: "));
+         print (gettext("Enter a username to add: "));
       }
     chomp($answer=<STDIN>);
     push(@names, $answer);
 }
 
 if (@names == 2) {     # must be addusertogroup
-    die ("$0: ",gtx("Specify only one name in this mode.\n"))
+    die ("$0: ",gettext("Specify only one name in this mode.\n"))
        if ($action eq "addsysuser" || $found_group_opt);
     $action = "addusertogroup";
     $existing_user = shift (@names);
@@ -145,18 +154,18 @@
 
 if ($action ne "addgroup" &&
     defined($found_group_opt) +defined($ingroup_name) +defined($new_gid) > 1 ) 
{
-    die ("$0: ",gtx("The --group, --ingroup, and --gid options are mutually 
exclusive.\n"));
+    die ("$0: ",gettext("The --group, --ingroup, and --gid options are 
mutually exclusive.\n"));
 }
 
 
 if ((defined($special_home)) && ($special_home !~ m+^/+ )) {
-  (die "$0: ",gtx("The home dir must be an absolute path.\n"))
+  (die "$0: ",gettext("The home dir must be an absolute path.\n"))
 }
           
 if (defined($special_home) && $verbose) {
-    print "$0: ",gtx("Warning: The home dir you specified already exists.\n")
+    print "$0: ",gettext("Warning: The home dir you specified already 
exists.\n")
       if (!defined($no_create_home) && -d $special_home);
-    print "$0: ",gtx("Warning: The home dir you specified does not exist.\n")
+    print "$0: ",gettext("Warning: The home dir you specified does not 
exist.\n")
       if (defined($no_create_home) && ! -d $special_home);
 }
 
@@ -217,12 +226,12 @@
 if ($action eq "addsysgroup") {
     # Check if requested group already exists and we can exit safely
     if (existing_group_ok($new_name, $new_gid)) {
-       printf (gtx("The group `%s' already exists as a system group. 
Exiting...\n"), $new_name) if $verbose;
+       printf (gettext("The group `%s' already exists as a system group. 
Exiting...\n"), $new_name) if $verbose;
        exit 0;
     }
-    dief (gtx("The group `%s' already exists and is not a system 
group.\n"),$new_name)
+    dief (gettext("The group `%s' already exists and is not a system 
group.\n"),$new_name)
        if (defined getgrnam($new_name));
-    dief (gtx("The GID `%s' is already in use.\n"),$new_gid)
+    dief (gettext("The GID `%s' is already in use.\n"),$new_gid)
        if (defined($new_gid) && defined(getgrgid($new_gid)));
     if (!defined($new_gid)) {
         $new_gid = &first_avail_id($config{"first_system_gid"},
@@ -230,18 +239,17 @@
                                   &get_current_gids);
 
         if ($new_gid == -1) {
-            print STDERR ("$0: ",gtx("No GID is available in the range "),
-            $config{"first_system_gid"}, " - ", $config{"last_system_gid"},
-            " (FIRST_SYS_GID - LAST_SYS_GID).\n");
-            dief (gtx("The group `%s' was not created.\n"),$new_name);
+            print STDERR "$0: ";
+            printf STDERR gettext("No GID is available in the range %d-%d 
(FIRST_SYS_GID - 
LAST_SYS_GID).\n"),$config{"first_system_gid"},$config{"last_system_gid"};
+            dief (gettext("The group `%s' was not created.\n"),$new_name);
         }
     }
 
-    printf (gtx("Adding group `%s' (%s)...\n"),$new_name,$new_gid) if $verbose;
+    printf (gettext("Adding group `%s' (%s)...\n"),$new_name,$new_gid) if 
$verbose;
     &invalidate_nscd("group");
     &systemcall('/usr/sbin/groupadd', '-g', $new_gid, $new_name);
     &invalidate_nscd("group");
-    print (gtx("Done.\n")) if $verbose;
+    print (gettext("Done.\n")) if $verbose;
     exit 0;
 }
 
@@ -250,9 +258,9 @@
 ## addgroup ##
 ##############
 if ($action eq "addgroup") {
-    dief (gtx("The group `%s' already exists.\n"),$new_name)
+    dief (gettext("The group `%s' already exists.\n"),$new_name)
        if (defined getgrnam($new_name));
-    dief (gtx("The GID `%s' is already in use.\n"),$new_gid)
+    dief (gettext("The GID `%s' is already in use.\n"),$new_gid)
        if (defined($new_gid) && defined(getgrgid($new_gid)));
     if (!defined($new_gid)) {
         $new_gid = &first_avail_id($config{"first_gid"},
@@ -260,18 +268,17 @@
                                   &get_current_gids);
 
         if ($new_gid == -1) {
-            print STDERR ("$0: ",gtx("No GID is available in the range "),
-            $config{"first_gid"}," - ", $config{"last_gid"},
-            " (FIRST_GID - LAST_GID).\n");
-            dief (gtx("The group `%s' was not created.\n"),$new_name);
+            print STDERR "$0: ";
+            printf STDERR gettext("No GID is available in the range %d-%d 
(FIRST_GID - LAST_GID).\n"),$config{"first_gid"},$config{"last_gid"};
+            dief (gettext("The group `%s' was not created.\n"),$new_name);
         }
     }
 
-    printf (gtx("Adding group `%s' (%s)...\n"),$new_name,$new_gid) if $verbose;
+    printf (gettext("Adding group `%s' (%s)...\n"),$new_name,$new_gid) if 
$verbose;
     &invalidate_nscd("group");
     &systemcall('/usr/sbin/groupadd', '-g', $new_gid, $new_name);
     &invalidate_nscd("group");
-    print (gtx("Done.\n")) if $verbose;
+    print (gettext("Done.\n")) if $verbose;
     exit 0;
 }
 
@@ -280,17 +287,17 @@
 ## addusertogroup ##
 ####################
 if ($action eq "addusertogroup") {
-    dief (gtx("The user `%s' does not exist.\n"),$existing_user)
+    dief (gettext("The user `%s' does not exist.\n"),$existing_user)
        if (!defined getpwnam($existing_user));
-    dief (gtx("The group `%s' does not exist.\n"),$existing_group)
+    dief (gettext("The group `%s' does not exist.\n"),$existing_group)
        if (!defined getgrnam($existing_group));
     if (&user_is_member($existing_user, $existing_group)) {
-       printf gtx("The user `%s' is already a member of `%s'.\n"),
+       printf gettext("The user `%s' is already a member of `%s'.\n"),
                 $existing_user,$existing_group if $verbose;
        exit 0;                 # not really an error
     }
 
-    printf gtx("Adding user `%s' to group 
`%s'...\n"),$existing_user,$existing_group
+    printf gettext("Adding user `%s' to group 
`%s'...\n"),$existing_user,$existing_group
        if $verbose;
     &invalidate_nscd();
     # FIXME - the next line has a race condition.
@@ -303,7 +310,7 @@
                $existing_group);
     #&systemcall('gpasswd', '-a',$existing_user,$existing_group);
     &invalidate_nscd();
-    print (gtx("Done.\n")) if $verbose;
+    print (gettext("Done.\n")) if $verbose;
     exit 0;
 }
 
@@ -313,23 +320,22 @@
 ################
 if ($action eq "addsysuser") {
     if (existing_user_ok($new_name, $new_uid)) {
-       printf (gtx("The user `%s' already exists as a system user. 
Exiting...\n"), $new_name) if $verbose;
+       printf (gettext("The user `%s' already exists as a system user. 
Exiting...\n"), $new_name) if $verbose;
        exit 0;
     }
     $new_gid = $nogroup_id
        if (!$ingroup_name && !defined($new_gid) && !$make_group_also);
     check_user_group(1);
-    printf (gtx("Adding system user `%s'...\n"),$new_name) if $verbose;
+    printf (gettext("Adding system user `%s'...\n"),$new_name) if $verbose;
 
     if (!defined($new_uid) && $make_group_also) {
        $new_uid = &first_avail_id($config{"first_system_uid"},
                                   $config{"last_system_uid"},
                                   &get_current_uids, &get_current_gids);
         if ($new_uid == -1) {
-            print STDERR ("$0: ",gtx("No UID/GID pair is available in the 
range "),
-            $config{"first_system_uid"}, " - ", $config{"last_system_uid"},
-            " (FIRST_SYS_UID - LAST_SYS_UID).\n");
-            dief (gtx("The user `%s' was not created.\n"),$new_name);
+            print STDERR "$0: ";
+            printf STDERR gettext("No UID/GID pair is available in the range 
%d-%d (FIRST_SYS_UID - 
LAST_SYS_UID).\n"),$config{"first_system_uid"},$config{"last_system_uid"};
+            dief (gettext("The user `%s' was not created.\n"),$new_name);
         }
         $new_gid = $new_uid;
        $ingroup_name = $new_name;
@@ -339,32 +345,31 @@
                                   $config{"last_system_uid"},
                                   &get_current_uids);
         if ($new_uid == -1) {
-            print STDERR ("$0: ",gtx("No UID is available in the range "),
-            $config{"first_system_uid"}," - ", $config{"last_system_uid"},
-            "(FIRST_SYS_UID - LAST_SYS_UID).\n");
-            dief (gtx("The user `%s' was not created.\n"),$new_name);
+            print STDERR "$0: ";
+            printf STDERR gettext("No UID is available in the range %d-%d 
(FIRST_SYS_UID - 
LAST_SYS_UID).\n"),$config{"first_system_uid"},$config{"last_system_uid"};
+            dief (gettext("The user `%s' was not created.\n"),$new_name);
         }
         if (defined($new_gid)) { $ingroup_name = getgrgid($new_gid); }
        elsif ($ingroup_name) { $new_gid = getgrnam($ingroup_name); }
-       else { die (gtx("Internal error")); }
+       else { die (gettext("Internal error")); }
     }
     else {
        if (defined($new_gid)) { $ingroup_name = getgrgid($new_gid); }
        elsif ($ingroup_name) { $new_gid = getgrnam($ingroup_name); }
        elsif ($make_group_also){ $new_gid=$new_uid; $ingroup_name=$new_name; }
-       else { die (gtx("Internal error")); }
+       else { die (gettext("Internal error")); }
     }
 
     &invalidate_nscd();
     # if we reach this point, and the group does already exist, we can use it.
     if ($make_group_also && !getgrnam($new_name)) {
-       printf (gtx("Adding new group `%s' (%s).\n"),$new_name,$new_gid) if 
$verbose;
+       printf (gettext("Adding new group `%s' (%s).\n"),$new_name,$new_gid) if 
$verbose;
        $undogroup = $new_name;
        &systemcall('/usr/sbin/groupadd', '-g', $new_gid, $new_name);
        &invalidate_nscd("group");
     }
 
-    printf gtx("Adding new user `%s' (%s) with group 
`%s'.\n"),$new_name,$new_uid,$ingroup_name
+    printf gettext("Adding new user `%s' (%s) with group 
`%s'.\n"),$new_name,$new_uid,$ingroup_name
        if $verbose;
     $home_dir = $special_home || &homedir($new_name, $ingroup_name);
        $shell = $special_shell || '/bin/false';
@@ -378,7 +383,7 @@
              if ($?>>8);
            &cleanup("$0: `/usr/bin/chage -M 99999 $new_name' exited from 
signal " . ($?&255) . ".  Aborting.\n");
        } else {
-           print (gtx("chage failed with return code 15, shadow not enabled, 
password aging cannot be set. Continuing.\n"));
+           print (gettext("chage failed with return code 15, shadow not 
enabled, password aging cannot be set. Continuing.\n"));
        }
     }
     &invalidate_nscd();
@@ -404,17 +409,16 @@
     check_user_group(0);
     $first_uid = $new_firstuid || $config{"first_uid"};
     $last_uid = $new_lastuid || $config{"last_uid"};
-    printf (gtx("Adding user `%s'...\n"),$new_name) if $verbose;
+    printf (gettext("Adding user `%s'...\n"),$new_name) if $verbose;
 
     if (!defined($new_uid) && $make_group_also) {
        $new_uid = &first_avail_id($first_uid,
                                   $last_uid,
                                   &get_current_uids, &get_current_gids);
         if ($new_uid == -1) {
-            print STDERR ("$0: ",gtx("No UID/GID pair is available in the 
range "),
-            "$first_uid - $last_uid\n",
-            "(FIRST_UID - LAST_UID).  ");
-            dief (gtx("The user `%s' was not created.\n"),$new_name);
+            print STDERR "$0: ";
+            printf STDERR gettext("No UID/GID pair is available in the range 
%d-%d (FIRST_UID - LAST_UID).\n"),$first_uid,$last_uid;
+            dief (gettext("The user `%s' was not created.\n"),$new_name);
         }
        $new_gid = $new_uid;
        $ingroup_name = $new_name;
@@ -424,31 +428,30 @@
                                   $last_uid,
                                   &get_current_uids);
        if ($new_uid == -1) {
-            print STDERR ("$0: ",gtx("No UID is available in the range "),
-            $config{"first_uid"}, " - ", $config{"last_uid"},
-            "(FIRST_UID - LAST_UID).\n");
-            dief (gtx("The user `%s' was not created.\n"),$new_name);
+            print STDERR "$0: ";
+            printf STDERR gettext("No UID is available in the range %d-%d 
(FIRST_UID - LAST_UID).\n"),$config{"first_uid"},$config{"last_uid"};
+            dief (gettext("The user `%s' was not created.\n"),$new_name);
         }
        if (defined($new_gid)) { $ingroup_name = getgrgid($new_gid); }
        elsif ($ingroup_name) { $new_gid = getgrnam($ingroup_name); }
-       else { die (gtx("Internal error")); }
+       else { die (gettext("Internal error")); }
     }
     else {
        if (defined($new_gid)) { $ingroup_name = getgrgid($new_gid); }
        elsif ($ingroup_name) { $new_gid = getgrnam($ingroup_name); }
        elsif ($make_group_also){ $new_gid=$new_uid; $ingroup_name=$new_name; }
-       else { die (gtx("Internal error")); }
+       else { die (gettext("Internal error")); }
     }
 
     &invalidate_nscd();
     if ($make_group_also) {
-       printf (gtx("Adding new group `%s' (%s).\n"),$new_name,$new_gid) if 
$verbose;
+       printf (gettext("Adding new group `%s' (%s).\n"),$new_name,$new_gid) if 
$verbose;
        $undogroup = $new_name;
        &systemcall('/usr/sbin/groupadd', '-g', $new_gid, $new_name);
        &invalidate_nscd();
     }
 
-    printf gtx("Adding new user `%s' (%s) with group 
`%s'.\n"),$new_name,$new_uid,$ingroup_name
+    printf gettext("Adding new user `%s' (%s) with group 
`%s'.\n"),$new_name,$new_uid,$ingroup_name
        if $verbose;
     $home_dir = $special_home || &homedir($new_name, $ingroup_name);
        $shell = $special_shell || $config{"dshell"};
@@ -474,14 +477,17 @@
     else {
        for (;;) {
            &systemcall('/usr/bin/chfn', $new_name);
-           print (gtx("Is the information correct? [y/N] "));
+           #  Translators: [y/N] has to be replaced by values defined in your
+           #  locale.  You can see by running "locale yesexpr" which regular
+           #  expression will be checked to find positive answer.
+           print (gettext("Is the information correct? [y/N] "));
            chop ($answer=<STDIN>);
-           last if ($answer eq gtx("y"));
+           last if ($answer =~ m/$yesexpr/o);
        }
     }
 
     if ($config{"quotauser"}) {
-       printf (gtx("Setting quota from `%s'.\n"),$config{quotauser});
+       printf (gettext("Setting quota from `%s'.\n"),$config{quotauser});
        &systemcall('/usr/sbin/edquota', '-p', $config{quotauser}, $new_name);
     }
 
@@ -514,21 +520,21 @@
   my ($copy_skeleton) = @_;
 
   if ($no_create_home) {
-      print gtx("Not creating $home_dir.\n") if $verbose;
+      printf gettext("Not creating %s.\n"), $home_dir if $verbose;
   }
   elsif (-e $home_dir) {
-      printf gtx("The home directory `%s' already exists.  Not copying from 
`%s'\n"),
+      printf gettext("The home directory `%s' already exists.  Not copying 
from `%s'\n"),
       $home_dir,$config{skel} if $verbose && !$no_create_home;
       my @homedir_stat = stat($home_dir);
       my $home_uid = $homedir_stat[4];
       my $home_gid = $homedir_stat[5];
       if (($home_uid != $new_uid) || ($home_gid != $new_gid)) {
-          warnf gtx("Warning: that home directory does not belong to user 
you're just creating\n");
+          warnf gettext("Warning: that home directory does not belong to user 
you're just creating\n");
       }
       undef @homedir_stat; undef $home_uid; undef $home_gid;
   }
   else {
-      printf gtx("Creating home directory `%s'.\n"),$home_dir if $verbose;
+      printf gettext("Creating home directory `%s'.\n"),$home_dir if $verbose;
       $undohome = $home_dir;
       &mktree($home_dir) || &cleanup("Couldn't create $home_dir: $!.\n");
       chown($new_uid, $new_gid, $home_dir)
@@ -538,7 +544,7 @@
          &cleanup("chmod $dir_mode $home_dir: $!\n");
 
       if ($config{"skel"} && $copy_skeleton) {
-         printf gtx("Copying files from `%s'\n"),$config{skel} if $verbose;
+         printf gettext("Copying files from `%s'\n"),$config{skel} if $verbose;
          open(FIND, "cd $config{skel}; find .  ! -name '*.dpkg-*' -print |")
              || &cleanup("fork for find: $!\n");
          while (<FIND>) {
@@ -613,26 +619,26 @@
     if( !$system || !existing_user_ok($new_name, $new_uid) ) {
        if( defined getpwnam($new_name) ) {
            if( $system ) {
-               dief (gtx("The user `%s' already exists, and is not a system 
user.\n"),$new_name);
+               dief (gettext("The user `%s' already exists, and is not a 
system user.\n"),$new_name);
            } else {
-               dief (gtx("The user `%s' already exists.\n"),$new_name);
+               dief (gettext("The user `%s' already exists.\n"),$new_name);
            }
        }
-       dief (gtx("The UID %s is already in use.\n"),$new_uid)
+       dief (gettext("The UID %s is already in use.\n"),$new_uid)
          if (defined($new_uid) && getpwuid($new_uid));
     }
     if ($make_group_also) {
        if( !$system || !existing_group_ok($new_name, $new_uid) ) {
-           dief (gtx("The group `%s' already exists.\n"),$new_name)
+           dief (gettext("The group `%s' already exists.\n"),$new_name)
              if (defined getgrnam($new_name));
-           dief (gtx("The GID %s is already in use.\n"),$new_uid)
+           dief (gettext("The GID %s is already in use.\n"),$new_uid)
              if (defined($new_uid) && defined(getgrgid($new_uid)));
        }
     }
     else {
-       dief (gtx("The group `%s' does not exist.\n"),$ingroup_name)
+       dief (gettext("The group `%s' does not exist.\n"),$ingroup_name)
            if ($ingroup_name && !defined(getgrnam($ingroup_name)));
-       dief (gtx("The GID %s does not exist.\n"),$new_gid)
+       dief (gettext("The GID %s does not exist.\n"),$new_gid)
            if (defined($new_gid) && !defined(getgrgid($new_gid)));
     }
 }
@@ -688,18 +694,18 @@
     my ($name) = @_;
     if ($name !~ /^[-_\.A-Za-z0-9]*\$?$/) {
        print STDERR
-("$0: ",gtx("To avoid problems, the username should consist of
+("$0: ",gettext("To avoid problems, the username should consist of
 letters, digits, underscores, periods and dashes. For compatibility with
 Samba machine accounts \$ is also supported at the end of the username\n"));
        exit 1;
     }
     if ($name !~ qr/$config{"name_regex"}/) {
       if ($allow_badname) {
-       print (gtx("Allowing use of questionable username.\n")) if ($verbose);
+       print (gettext("Allowing use of questionable username.\n")) if 
($verbose);
       }
       else {
         print STDERR
-("$0: ",gtx("Please enter a username matching the regular expression configured
+("$0: ",gettext("Please enter a username matching the regular expression 
configured
 via the name_regex configuration variable.  Use the `--force-badname'
 option to relax this check or reconfigure name_regex.\n"));
         exit 1;
@@ -714,7 +720,7 @@
 sub first_avail_id {
     my ($min, $max, @ids) = @_;
     @ids = sort {$a <=> $b} @ids;
-    printf (gtx("Selecting from %s %s (%s).\n"),$min,$max,join(",",@ids)) if 
$debugging;
+    printf (gettext("Selecting from %s %s (%s).\n"),$min,$max,join(",",@ids)) 
if $debugging;
     
     while ($min <= $max) {
        return $min if ($min <  $ids[0] || @ids==0);
@@ -779,15 +785,15 @@
 sub cleanup {
     print ("@{_}Cleaning up.\n");
     if ($undohome) {
-       printf (gtx("Removing directory `%s'\n"),$undohome);
+       printf (gettext("Removing directory `%s'\n"),$undohome);
        system('rm', '-rf', $undohome);
     }
     if ($undouser) {
-       printf (gtx("Removing user `%s'.\n"),$undouser);
+       printf (gettext("Removing user `%s'.\n"),$undouser);
        system('userdel', $undouser);
     }
     if ($undogroup) {
-       printf (gtx("Removing group `%s'.\n"),$undogroup);
+       printf (gettext("Removing group `%s'.\n"),$undogroup);
        system('groupdel', $undogroup);
     }
     # do we need to invalidate the nscd cache here, too?
@@ -819,7 +825,7 @@
 }
 
 sub usage {
-    printf gtx(
+    printf gettext(
 "adduser [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID]
 [--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID]
 [--disabled-password] [--disabled-login] user
diff -ur adduser-3.74.orig/deluser adduser-3.74/deluser
--- adduser-3.74.orig/deluser   2005-10-18 16:20:00.000000000 +0200
+++ adduser-3.74/deluser        2005-10-21 23:48:55.000000000 +0200
@@ -91,7 +91,7 @@
            "backup-to" => \$pconfig{"backup_to"}
          );
 
-die ("$0: ",gtx("Only root may remove a user or group from the system.\n")) if 
($> != 0);
+die ("$0: ",gettext("Only root may remove a user or group from the 
system.\n")) if ($> != 0);
 
 if (!defined($configfile)) { 
     @defaults = ("/etc/adduser.conf", "/etc/deluser.conf");
@@ -108,7 +108,7 @@
 
 while (defined(my $arg = shift(@ARGV))) {
   if (defined($names[0]) && $arg =~ /^--/) {
-      die ("$0: ",gtx("No options allowed after names.\n"));
+      die ("$0: ",gettext("No options allowed after names.\n"));
     } else {                   # it's a username
        push (@names, $arg);
     }
@@ -116,15 +116,15 @@
 
 if(@names == 0) {
     if($action eq "delgroup") {
-       print (gtx("Enter a group name to remove: "));
+       print (gettext("Enter a group name to remove: "));
     } else {
-       print (gtx("Enter a user name to remove: "));
+       print (gettext("Enter a user name to remove: "));
     }
     chomp(my $answer=<STDIN>);
     push(@names, $answer);
 }
-die ("$0: ",gtx("No name to remove given.\n")) if (length($names[0]) == 0);
-die ("$0: ",gtx("No more than two names.\n")) if (@names > 2);
+die ("$0: ",gettext("No name to remove given.\n")) if (length($names[0]) == 0);
+die ("$0: ",gettext("No more than two names.\n")) if (@names > 2);
 
 if(@names == 2) {      # must be deluserfromgroup
     $action = "deluserfromgroup";
@@ -157,9 +157,9 @@
 undef (%pconfig);
 
 if (($config{remove_home} || $config{remove_all_files} || $config{backup}) && 
($install_more_packages)) {
-    die (gtx("In order to use the --remove-home, --remove-all-files, and 
--backup features,\n
-    you need to install the `perl-modules' package. To accomplish that, run\n
-    apt-get install perl-modules\n"));
+    die (gettext("In order to use the --remove-home, --remove-all-files, and 
--backup features,
+you need to install the `perl-modules' package. To accomplish that, run
+apt-get install perl-modules\n"));
 }
 
  
@@ -206,36 +206,36 @@
        if( ($dummy1,$dummy2,$uid) = getpwnam($user) ) {
            if ( ($uid < $config{"first_system_uid"} ||
                $uid > $config{"last_system_uid" } ) ) {
-               printf (gtx("The user `%s' is not a system account... 
Exiting.\n"), $user) if $verbose;
+               printf (gettext("The user `%s' is not a system account... 
Exiting.\n"), $user) if $verbose;
                exit 0;
            }
         } else {
-           printf (gtx("The user `%s' does not exist, but --system was 
given... Exiting.\n"), $user) if $verbose;
+           printf (gettext("The user `%s' does not exist, but --system was 
given... Exiting.\n"), $user) if $verbose;
            exit 0;
        }
     }
     
     unless(exist_user($user)) {
-       dief (gtx("The user `%s' does not exist.\n"),$user);
+       dief (gettext("The user `%s' does not exist.\n"),$user);
     }
 
     if($config{"remove_home"} && $config{"home"} && ($config{"home"} ne "") && 
($config{"home"} ne $pw_homedir)) {
-       dief (gtx("passwd home dir `%s' does not match command line home dir, 
aborting.\n"),
+       dief (gettext("passwd home dir `%s' does not match command line home 
dir, aborting.\n"),
        $pw_homedir,$config{"home"});
     } 
 
 
     if($config{"remove_home"} || $config{"remove_all_files"}) {
-      s_print (gtx("Looking for files to backup/remove...\n"));
+      s_print (gettext("Looking for files to backup/remove...\n"));
       my @mountpoints;
       open(MOUNT, "mount |")
-             || die (gtx("fork for parse mount points failed: %s\n", $!));
+             || die (gettext("fork for parse mount points failed: %s\n", $!));
       while (<MOUNT>) {
              chomp;
              my @temparray = split;
              push @mountpoints,$temparray[2];
       }
-      close(MOUNT) or die (gtx("can't close mount pipe: %s\n",$!));
+      close(MOUNT) or die (gettext("can't close mount pipe: %s\n",$!));
       my(@files,@dirs);
       if($config{"remove_home"} && ! $config{"remove_all_files"}) {
 
@@ -243,14 +243,14 @@
          # according to the manpage
          foreach my $mount (@mountpoints) {
            if( $File::Find::name eq $mount ) {
-             s_printf (gtx("Not backing up/removing `%s', it is a mount 
point.\n"),$File::Find::name);
+             s_printf (gettext("Not backing up/removing `%s', it is a mount 
point.\n"),$File::Find::name);
              $File::Find::prune=1;
              return;
            }
          }
          foreach my $re ( split ' ', $config{"no_del_paths"} ) {
            if( $File::Find::name =~ qr/$re/ ) {
-             s_printf (gtx("Not backing up/removing `%s', it matches 
%s.\n"),$File::Find::name,$re);
+             s_printf (gettext("Not backing up/removing `%s', it matches 
%s.\n"),$File::Find::name,$re);
              $File::Find::prune=1;
              return;
            }
@@ -282,7 +282,7 @@
       }
 
       if($config{"backup"}) {
-         s_print (gtx("Backing up files to be removed to ". 
$config{"backup_to"}. " ...\n"));
+         s_print (gettext("Backing up files to be removed to ". 
$config{"backup_to"}. " ...\n"));
          my $filesfile = new File::Temp(TEMPLATE=>"deluser.XXXXX", 
DIR=>"/tmp");
          my $filesfilename = $filesfile->filename;
          print $filesfile join("\n",@files);
@@ -297,7 +297,7 @@
       }
 
       if(@files || @dirs) {
-         s_print (gtx("Removing files...\n"));
+         s_print (gettext("Removing files...\n"));
          unlink(@files) if(@files);
          foreach(reverse(sort(@dirs))) {
              rmdir($_);
@@ -305,14 +305,14 @@
       }
     }
 
-    s_printf (gtx("Removing user `%s'...\n"),$user);
+    s_printf (gettext("Removing user `%s'...\n"),$user);
     systemcall("/usr/sbin/userdel", $user);
     &invalidate_nscd();
 
     systemcall('/usr/local/sbin/deluser.local', $user, $pw_uid,
                 $pw_gid, $pw_homedir) if (-x "/usr/local/sbin/deluser.local");
 
-    s_print (gtx("done.\n"));
+    s_print (gettext("done.\n"));
     exit 0;
 }
 
@@ -320,34 +320,34 @@
 if($action eq "delgroup") {
     &invalidate_nscd();
     unless(exist_group($group)) {
-       dief (gtx("The group `%s' does not exist.\n"),$group);
+       dief (gettext("The group `%s' does not exist.\n"),$group);
     }
     my($dummy,$gid,$members);
     if( !(($dummy, $dummy, $gid, $members ) = getgrnam($group)) ) {
-       dief (gtx("getgrnam `%s' failed. This shouldn't happen.\n"), $group);
+       dief (gettext("getgrnam `%s' failed. This shouldn't happen.\n"), 
$group);
     }
     if( $config{"system"} && 
        ($gid < $config{"first_system_gid"} ||
         $gid > $config{"last_system_gid" } )) {
-        printf (gtx("The group `%s' is not a system group... Exiting.\n"), 
$group) if $verbose;
+        printf (gettext("The group `%s' is not a system group... Exiting.\n"), 
$group) if $verbose;
        exit 0;
     }
     if( $config{"only_if_empty"} && $members ne "") {
-       dief (gtx("The group `%s' is not empty!\n"),$group);
+       dief (gettext("The group `%s' is not empty!\n"),$group);
     }
     
     setpwent;
     while ((my $acctname,my $primgrp) = (getpwent)[0,3]) {
        if( $primgrp eq $gr_gid ) {
-           dief (gtx("`%s' still has `%s' as their primary 
group!\n"),$acctname,$group);
+           dief (gettext("`%s' still has `%s' as their primary 
group!\n"),$acctname,$group);
        }
     }
     endpwent;
 
-    s_printf (gtx("Removing group `%s'...\n"),$group);
+    s_printf (gettext("Removing group `%s'...\n"),$group);
     systemcall("/usr/sbin/groupdel",$group);
     &invalidate_nscd();
-    s_print (gtx("done.\n"));
+    s_print (gettext("done.\n"));
     exit 0;
 }
 
@@ -356,13 +356,13 @@
 {
     &invalidate_nscd();
     unless(exist_user($user)) {
-       dief (gtx("The user `%s' does not exist.\n"),$user);
+       dief (gettext("The user `%s' does not exist.\n"),$user);
     }
     unless(exist_group($group)) {
-       dief (gtx("The group `%s' does not exist.\n"),$group);
+       dief (gettext("The group `%s' does not exist.\n"),$group);
     }
     if($maingroup eq $group) {
-       die ("$0: ",gtx("You may not remove the user from his/her primary 
group.\n"));
+       die ("$0: ",gettext("You may not remove the user from his/her primary 
group.\n"));
     }
 
     my @members = get_group_members($group);
@@ -376,29 +376,29 @@
     }
 
     unless($ismember) {
-       dief (gtx("The user `%s' is not a member of group 
`%s'.\n"),$user,$group);
+       dief (gettext("The user `%s' is not a member of group 
`%s'.\n"),$user,$group);
     }
 
-    s_printf (gtx("Removing user `%s' from group `%s'...\n"),$user,$group);
+    s_printf (gettext("Removing user `%s' from group `%s'...\n"),$user,$group);
     #systemcall("usermod","-G", join(",",@groups), $user );
     systemcall('/usr/bin/gpasswd','-M', join(',',@members), $group);
     &invalidate_nscd();
-    s_print (gtx("done.\n"));
+    s_print (gettext("done.\n"));
 }
 
 
 ######
 
 sub version {
-    printf (gtx("deluser: (version: %s)\n\n", $version));
-    printf (gtx("removing user and groups from the system. "));
+    printf (gettext("deluser: (version: %s)\n\n", $version));
+    printf (gettext("removing user and groups from the system. "));
 
-    printf gtx("Copyright (C) 2000 Roland Bauerschmidt <[EMAIL 
PROTECTED]>\n\n");
+    printf gettext("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 gettext("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
+    printf gettext("\nThis program is free software; you can redistribute it 
and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at
 your option) any later version.
@@ -410,10 +410,10 @@
 }
 
 sub usage {
-    printf (gtx("deluser: (version %s)\n\n", $version));
-    printf gtx("removing user and groups from the system. Version:");
+    printf (gettext("deluser: (version %s)\n\n", $version));
+    printf gettext("removing user and groups from the system. Version:");
 
-    printf gtx("deluser user
+    printf gettext("deluser user
   remove a normal user from the system
   example: deluser mike
 
diff -ur adduser-3.74.orig/po/Makefile adduser-3.74/po/Makefile
--- adduser-3.74.orig/po/Makefile       2005-10-04 14:27:49.000000000 +0200
+++ adduser-3.74/po/Makefile    2005-10-21 23:24:01.000000000 +0200
@@ -21,7 +21,7 @@
        done;
 
 adduser.pot: ../adduser ../deluser ../AdduserCommon.pm
-       $(XGETTEXT) -L Perl -k_ -o $@ $?
+       $(XGETTEXT) -L Perl -c -o $@ $?
 
 install: all
        for i in $(MO) ; do \

Reply via email to