On Wednesday 02 April 2008, Frans Pop wrote: > This indeed is a real issue.
I've been looking at a solution for this in debconf, but am confused. # LANG= LANGUAGE=nl LC_ALL=en_US.UTF-8 ../../test-debconf-C => Dialog is displayed in Dutch @langs = nl:en_us.utf-8:en_us:en.utf-8:en # LANG= LANGUAGE=en LC_ALL=nl_NL.UTF-8 ../../test-debconf-C => Dialog is displayed in Dutch @langs = en:nl_nl.utf-8:nl_nl:nl.utf-8:nl (Values for @langs are from /usr/share/perl5/Debconf/Template.pm.) Why are both cases displayed in Dutch? I would have expected English for the second. It seems that because there are no specific -en.UTF-8 templates for English, Dutch ends up being preferred. This basically means that for debconf you'll never be able to override a specific locale setting using LANGUAGE=C or LANGUAGE=en; you'll always have to specify the locale and have LANGUAGE unset. # LANG= LANGUAGE=en LC_ALL=C ../../test-debconf-C => Choices-C values are displayed @langs = en:c Here again, C is the first actual match because Choices-C exists. # LANG= LANGUAGE= LC_ALL=en_US.UTF-8 ../../test-debconf-C => Dialog is displayed in English @langs = en_us.utf-8:en_us:en.utf-8:en Here the display is finally correct, but only because there is _no_ match at all... I wonder if this patch to /usr/share/perl5/Debconf/Template.pm would be the correct way to solve this issue: --- ../../Template.pm 2008-04-02 13:39:54.000000000 +0200 +++ /usr/share/perl5/Debconf/Template.pm 2008-04-02 13:53:17.000000000 +0200 @@ -279,6 +279,7 @@ } my @langs=map { lc $_ } _getlangs(); +print join(":", @langs), "\n"; sub AUTOLOAD { (my $field = our $AUTOLOAD) =~ s/.*://; @@ -294,6 +294,8 @@ if ($Debconf::Template::i18n && @langs) { my @fields = grep /^\Q$field\E(?:[EMAIL PROTECTED]|$)/, $Debconf::Db::templates->fields($this->{template}); foreach my $lang (@langs) { + $lang="en" if ($lang eq "c"); + $ret=$Debconf::Db::templates->getfield($this->{template}, $field.'-'.$lang); return $ret if defined $ret; @@ -306,6 +308,8 @@ } } } + + last if ($lang eq "en") } } elsif (not $Debconf::Template::i18n && $field !~ /-c$/i) { $ret=$Debconf::Db::templates->getfield($this->{template}, $field.'-c'); The first hunk makes sure that "Choices-C" fields are never explicitly selected, but English is used instead. The second hunk solves the second example I started with by breaking out of the loop if the language is "en" and thereby ensuring debconf defaults to the standard field. Cheers, FJP
signature.asc
Description: This is a digitally signed message part.