updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / eglibc-2.12-svn / locale-gen
blob5aff344c4e91139757c1c76d2e7018d23733522e
1 #!/bin/sh
3 set -e
5 LOCALEGEN=/etc/locale.gen
6 LOCALES=/usr/share/i18n/locales
7 if [ -n "$POSIXLY_CORRECT" ]; then
8 unset POSIXLY_CORRECT
9 fi
12 [ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
14 # Remove all old locale dir and locale-archive before generating new
15 # locale data.
16 rm -rf /usr/lib/locale/* || true
18 umask 022
20 is_entry_ok() {
21 if [ -n "$locale" -a -n "$charset" ] ; then
22 true
23 else
24 echo "error: Bad entry '$locale $charset'"
25 false
29 echo "Generating locales..."
30 while read locale charset; do \
31 case $locale in \#*) continue;; "") continue;; esac; \
32 is_entry_ok || continue
33 echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
34 echo -n ".$charset"; \
35 echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
36 echo -n '...'; \
37 if [ -f $LOCALES/$locale ]; then input=$locale; else \
38 input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
39 localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
40 echo ' done'; \
41 done < $LOCALEGEN
42 echo "Generation complete."