[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Sorted debconf lists (was Re: r14631 - in trunk/packages/countrychooser: . debian)



On Mon, May 03, 2004 at 11:58:47PM +0100, Martin Michlmayr wrote:
> * Denis Barbier <barbier@linuxfr.org> [2004-05-04 00:41]:
> > Err, I am lost.  Your original comment is about #215205.  AFAICS
> > this bug can be closed, Petter prepended language choices with
> > locale names.
> > If you are looking at countrychooser, the easiest solution is indeed
> 
> No, sorry, I'm talking about choose-mirror, namely:
> 236354: installation-reports: Archive mirror country should be
> alphabetical by name, not country
> 
> But I guess this is similar to what you just said about
> countrychooser.

Absolutely.
I am testing the attached patch to sort short country list in
countrychooser.  It can be adapted to choose-mirror, but its drawback
is that generation of many locales may take some time on autobuilders
(which is not a problem with countrychooser which needs fewer locales
and is Arch: all).
Christian, I have very few time, so feel free to commit if you like it.

Denis
Index: mkshort
===================================================================
--- mkshort	(revision 14713)
+++ mkshort	(working copy)
@@ -5,13 +5,11 @@
 ISO3166TAB=/usr/share/iso-codes/iso_3166.tab
 SUPPORTED=/usr/share/i18n/SUPPORTED
 
-if [ ! -d debian/short-tmp ]; then
-   mkdir debian/short-tmp
-fi
+rm -rf debian/short-tmp
+rm -rf debian/locales
+mkdir debian/short-tmp
+mkdir debian/locales
 
-rm -f debian/short-tmp/*.tab
-rm -f debian/short-tmp/*.short
-
 for file in debian/po/*.po en.po; do
   lang_variant=`basename $file .po`
   lang=$(echo "$lang_variant" | sed -e 's/_.*$//')
@@ -20,9 +18,12 @@
   msgconv debian/iso-codes/$lang_variant.po -t UTF-8 --stringtable-output | tail -n +3 | \
      sed -e 's/" = "/	/' -e 's/^"//' -e 's/";$//' | awk '/^.+$/{print}'> $tabfile
   outfile=debian/short-tmp/$lang_variant.short
-  :>$outfile
-  (for code in $(grep -e "^$lang" $SUPPORTED | cut -b 4-5 | sort | uniq); do
+  lastlocale=C
+  :> $outfile
+  for locale in $(grep -e "^$lang" $SUPPORTED | sed -e 's/[@. ].*//' | sort | uniq); do
+      code=`echo "$locale" | sed -e 's/.*_//'`
       line=`grep -e "^$code" $ISO3166TAB`
+      lastlocale=$locale
       if [ "$line" ]; then
          OLD_IFS="$IFS"
 	 IFS='	'
@@ -37,9 +38,12 @@
 	   fi
 	 fi
       fi
-   done)
+   done
    if [ $(wc -l < $outfile) -le 1 ]; then
       rm -f $outfile
+   else
+      localedef -c -f UTF-8 -i $lastlocale debian/locales/$lastlocale.UTF-8
+      LOCPATH=`pwd` LC_ALL=debian/locales/$lastlocale.UTF-8 sort -k 2.1 $outfile > $outfile.tmp && mv $outfile.tmp $outfile
    fi
 done
 

Reply to: