Bug#272284: Selection of en + NL results in non-existent locale 'en_US@euro'
Package: countrychooser
Version: 1.03
Severity: important
Selection of English as language and Netherlands as country results in
FALLBACKLOCALE being used. However, the fallback locale does not include a
test to see if it exists.
I think the easiest solution would be to add a test for the existence of the
fallbacklocale and, if it does not, remove any postfix (I guess we may
assume that any fallback locale without a postfix will exist anyway).
Whilst I was testing this, I also noticed that the FALLBACKLOCALE appears
not to be set inside countrychooser's postinst script, but to somehow
inherit it's value from languagechooser.
There is a line 'fallbacklocalecode="debian-installer/fallbacklocale"', but
a db_get is never performed.
The attached patch should fix both problems. Tested, but please check.
--- postinst 2004-09-19 01:46:41.000000000 +0200
+++ new/postinst 2004-09-19 01:55:01.000000000 +0200
@@ -148,10 +148,21 @@
# Just in case
DEFAULTLOCALE="C"
fi
+
+# Finally grab the fallback locale we got from languagechooser
+db_get "$fallbacklocalecode"
+if [ -n "$RET" ]; then
+ FALLBACKLOCALE="$RET"
+else
+ # Just in case
+ FALLBACKLOCALE="C"
+fi
+
# If present, keep track of charset or modifier we got from languagechooser
# This charset or modifier is in the fallback locale
EXTRA_LANGUAGECHOOSER=`echo $FALLBACKLOCALE | sed -e 's/^[^.@]*//'`
+
FIRST_LANG=$(echo $LANGUAGELIST | sed -e 's/:.*$//')
if grep -q "^$FIRST_LANG" $SHORTLISTS; then
@@ -241,6 +252,7 @@
log "COUNTRYCODE = '$COUNTRYCODE'"
log "COUNTRYCODE_LANGUAGECHOOSER = '$COUNTRYCODE_LANGUAGECHOOSER'"
log "LOCALE_LANGUAGECHOOSER = '$LOCALE_LANGUAGECHOOSER'"
+log "FALLBACKLOCALE = '$FALLBACKLOCALE'"
for entry in ${LANGUAGE}_${COUNTRYCODE}${EXTRA_LANGUAGECHOOSER} \
${LANGUAGE}_${COUNTRYCODE}; do
@@ -277,8 +289,12 @@
# Fall back to a supported locale.
if [ -z "${LOCALE}" ]; then
- LOCALE="${FALLBACKLOCALE}"
- log "falling back to locale '${FALLBACKLOCALE}'"
+ if grep -q "^${FALLBACKLOCALE}$" $SUPPORTEDLOCALES; then
+ LOCALE="${FALLBACKLOCALE}"
+ else
+ LOCALE=`echo $FALLBACKLOCALE | sed -e 's/[.@].*$//'`
+ fi
+ log "falling back to locale '${LOCALE}'"
fi
# Set the locale.
Reply to: