Package: tasksel
Version: 2.14
Followup-For: Bug #278186

Christian Perrier wrote:
> When preseeding tasksel, the value(s) preseeded in tasksel/first must
> use the localized names.
> 
> For instance, if D-I was run in French and one wants to install the
> Dektop tasks, tasksel/first must be preseeded with "Environnement
> graphique de bureau" and not "Desktop environment".

No, debconf is designed so that choices values are always in English.
Here is a (not fully tested) patch to build a rightfully localized
choices list.  It can surely be improved, but the main point is to
build 2 lists (in English and another language) and perform 2 different
substitutions so that Choices and Choices-xx fields are expanded as if
they had been computed at build time by po2debconf.

Denis
Index: tasksel.pl
===================================================================
--- tasksel.pl  (revision 816)
+++ tasksel.pl  (working copy)
@@ -64,7 +64,8 @@
                }
                if (%data) {
                        $data{relevance}=5 unless exists $data{relevance};
-                       $data{shortdesc}=dgettext("debian-tasks", 
$data{description}->[0]);
+                       $data{shortdesc}=$data{description}->[0];
+                       $data{shortdesctrans}=dgettext("debian-tasks", 
$data{shortdesc});
                        push @ret, \%data;
                }
        }
@@ -252,8 +253,9 @@
 
 # Converts a list of tasks into a debconf list of their short descriptions.
 sub task_to_debconf {
+       my $field = shift;
        join ", ", map {
-               my $desc=$_->{shortdesc};
+               my $desc=$_->{$field};
                if ($desc=~/, /) {
                        warning("task ".$_->{task}." contains a comma in its short 
description: \"$desc\"");
                }
@@ -415,8 +417,10 @@
                my @default = grep { $_->{_display} == 1 && ($_->{_install} == 1 || 
$_->{_installed} == 1) } @tasks;
                my $tmpfile=`tempfile`;
                chomp $tmpfile;
-               system($debconf_helper, $tmpfile, task_to_debconf(@list),
-                       task_to_debconf(@default),
+               system($debconf_helper, $tmpfile,
+                       task_to_debconf("shortdesc", @list),
+                       task_to_debconf("shortdesctrans", @list),
+                       task_to_debconf("shortdesc", @default),
                        $question);
                open(IN, "<$tmpfile");
                my $ret=<IN>;
Index: debian/rules
===================================================================
--- debian/rules        (revision 816)
+++ debian/rules        (working copy)
@@ -51,6 +51,7 @@
        dh_strip
        dh_compress
        dh_installdebconf
+       perl -pi -e 's/^Choices: \$${CHOICES}/Choices: \$${ORIGCHOICES}/' 
debian/tasksel/DEBIAN/templates
        dh_fixperms
        dh_installdeb
        dh_shlibdeps
Index: tasksel-debconf
===================================================================
--- tasksel-debconf     (revision 816)
+++ tasksel-debconf     (working copy)
@@ -5,11 +5,13 @@
 
 tmpfile=$1
 choices="$2"
-defaults="$3"
-question=$4
+choicestrans="$3"
+defaults="$4"
+question=$5
 
 db_settitle tasksel/title
-db_subst $question CHOICES "$choices"
+db_subst $question ORIGCHOICES "$choices"
+db_subst $question CHOICES "$choicestrans"
 
 # Allow tasksel/first to be preseeded. If it's marked as seen, then
 # it must have been preseeded, and that overrides any defaults set by

Reply via email to