4
# If locale-gen is not present, do nothing
5
[ -x /usr/sbin/locale-gen ] || exit 0
10
if [ "$1" = configure ]; then
12
. /usr/share/debconf/confmodule
15
db_get belocs-locales-data/locales_to_be_generated && SELECTED_LOCALES=$RET
16
db_get belocs-locales-data/default_environment_locale && SELECTED="$RET"
18
if [ -n "$SELECTED_LOCALES" ]; then
20
# Comment previous defined locales
21
LC_ALL=C sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
23
last=`tail -n 1 "$LG"`
24
if test -n "$last"; then echo >> $LG; fi
27
# This file lists locales that you wish to have built. You can find a list
28
# of valid supported locales at /usr/share/i18n/SUPPORTED. Other
29
# combinations are possible, but may not be well tested. If you change
30
# this file, you need to rerun locale-gen.
35
list=`echo $SELECTED_LOCALES | sed -e 's/, /,/g'`
38
for locale in $list; do
39
if grep -q "^$locale *\$" $LG; then
40
# This locale has already been inserted, do nothing
42
elif grep -q "^#$locale *\$" $LG; then
43
# Uncomment previous defined locales
44
sed -e "s,#$locale *\$,$locale," $LG > $LG.tmp || true
54
LC_ALL=C sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
58
# Update requested locales.
61
# Set default LANG environment variable
63
sed -e '/^ *LANG=/d' $EE > $EE.tmp || true
64
# $EE has to be updated if $SELECTED is empty or 'None'
69
if [ -n "$SELECTED" ] && [ "$SELECTED" != "None" ]; then
70
# Add a newline in case last line does not have one
72
echo "LANG=$SELECTED" >> $EE.tmp
73
# Consecutive blank lines are replaced by a single line