> The attached patch switches localechooser to use a default country for
> BOTH the short and long list, which can be set at build time.


It did not for the long list. The attached patch does.

It is not perfect yet, as it requires the translators to set the
default country for the short list with the country ISO code...and for
the long list with the country English name. Not really optimal, but
it seems to work.

Anyway, the planned rewrite for the long list thing (with an
intermediate question about continent) will allow rewriting all this
with the long list using ISO codes internally, just like the short
list currently does.


diff -Nru localechooser.ori/debian/localechooser.templates-in 
localechooser/debian/localechooser.templates-in
--- localechooser.ori/debian/localechooser.templates-in 2005-06-22 
21:58:45.000000000 +0200
+++ localechooser/debian/localechooser.templates-in     2005-06-24 
18:38:33.000000000 +0200
@@ -51,6 +51,7 @@
 Template: countrychooser/country-name
 Type: select
 Choices: @countrylist@
+_Default: United States [ Translators: put here the ISO-3166 ENGLISH NAME of 
the country which should be selected as default for your language ]
 # Notes to translators
 #  The country names are not part of this package
 #
@@ -71,6 +72,7 @@
 Type: select
 __Choices: ${SHORTLIST}, other
 _Description: Choose a country, territory or area:
+_Default: US [ Translators: put here the ISO-3166 CODE of the country which 
should be selected as default for your language ]
  Based on your language, you are probably located in one of these countries
  or regions.
 
diff -Nru localechooser.ori/debian/rules localechooser/debian/rules
--- localechooser.ori/debian/rules      2005-06-22 21:58:45.000000000 +0200
+++ localechooser/debian/rules  2005-06-26 17:40:39.000000000 +0200
@@ -14,7 +14,7 @@
        dh_testroot
        rm -f build-stamp
        $(MAKE) clean
-       rm -rf debian/pobuild debian/iso-codes debian/short-tmp debian/locales
+       rm -rf debian/pobuild debian/iso-codes debian/short-tmp debian/locales 
debian/SUPPORTED-short
        dh_clean
 
 install: build
diff -Nru localechooser.ori/localechooser localechooser/localechooser
--- localechooser.ori/localechooser     2005-06-22 21:58:45.000000000 +0200
+++ localechooser/localechooser 2005-06-26 16:57:32.000000000 +0200
@@ -323,10 +323,10 @@
                                        
shortlist_template="$shortlist-$use_lang"
                                        db_register $shortlist_template 
$shortlist
                                        # Set the default
-                                       db_fget $shortlist seen
-                                       if [ "$RET" = false ]; then
-                                               db_set $shortlist 
$COUNTRYCODE_LANGUAGECHOOSER
-                                       fi
+                                       #db_fget $shortlist seen
+                                       #if [ "$RET" = false ]; then
+                                       #       db_set $shortlist 
$COUNTRYCODE_LANGUAGECHOOSER
+                                       #fi
                                        db_input $shortprio $shortlist || [ $? 
-eq 30 ]
                                        askedshort=1
                                fi
diff -Nru localechooser.ori/mkshort localechooser/mkshort
--- localechooser.ori/mkshort   2005-06-22 21:58:45.000000000 +0200
+++ localechooser/mkshort       2005-06-24 18:48:20.000000000 +0200
@@ -54,6 +54,7 @@
    if [ $(wc -l < $outfile) -le 1 ]; then
       rm -f $outfile
    else
+      echo $lang
       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
diff -Nru localechooser.ori/mk_shortlist_templates 
localechooser/mk_shortlist_templates
--- localechooser.ori/mk_shortlist_templates    2005-06-22 21:58:45.000000000 
+0200
+++ localechooser/mk_shortlist_templates        2005-06-24 18:46:36.000000000 
+0200
@@ -37,14 +37,21 @@
 EN_DESCR=$(awk -v ITEM="Description:" -f template_get_item.awk \
     $TEMPLATE_TMP)
 
-
 # Add new templates for each language that needs a shortlist
 for LANG in $SHORTLIST_LANGS; do
-    echo "Language: $LANG"
-    
+
+    # Get the default value
+    LANG_DEFAULT_COUNTRY=$(awk -v ITEM="Default-$LANG.UTF-8:" -f 
template_get_item.awk \
+       $TEMPLATE_TMP | head -1)
+
+    echo "$LANG"
+
     # Write the 'template header' to the file
     echo "Template: $TEMPLATE_NAME-$LANG" >>$TEMPLATE_NEW
     echo "Type: select" >>$TEMPLATE_NEW
+    if [ -n "$LANG_DEFAULT_COUNTRY" ] ; then
+       echo "$LANG_DEFAULT_COUNTRY" >>$TEMPLATE_NEW
+    fi
     
     # Next we put the countrycodes in the untranslated shortlist
     SHORTLIST=

Reply via email to