summaryrefslogtreecommitdiff
path: root/testing/glibc/locale-gen
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2011-06-09 13:03:24 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2011-06-09 13:03:24 -0300
commit06a22f3bf7a44edf24bd02b6023cf05a6bc77256 (patch)
tree583c62f4fbd0d8ed3401fb1f34ea5756b8aee8d4 /testing/glibc/locale-gen
parentd54a0874c6641a08e4cc71269e8be3a1919e70a4 (diff)
parent498f3fc095103b2a220a00b27d43f4dae02d5459 (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: core/gcc/PKGBUILD extra/qt/PKGBUILD multilib/gcc-multilib/PKGBUILD testing/pidgin/PKGBUILD
Diffstat (limited to 'testing/glibc/locale-gen')
-rwxr-xr-xtesting/glibc/locale-gen42
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/glibc/locale-gen b/testing/glibc/locale-gen
new file mode 100755
index 000000000..5aff344c4
--- /dev/null
+++ b/testing/glibc/locale-gen
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+set -e
+
+LOCALEGEN=/etc/locale.gen
+LOCALES=/usr/share/i18n/locales
+if [ -n "$POSIXLY_CORRECT" ]; then
+ unset POSIXLY_CORRECT
+fi
+
+
+[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
+
+# Remove all old locale dir and locale-archive before generating new
+# locale data.
+rm -rf /usr/lib/locale/* || true
+
+umask 022
+
+is_entry_ok() {
+ if [ -n "$locale" -a -n "$charset" ] ; then
+ true
+ else
+ echo "error: Bad entry '$locale $charset'"
+ false
+ fi
+}
+
+echo "Generating locales..."
+while read locale charset; do \
+ case $locale in \#*) continue;; "") continue;; esac; \
+ is_entry_ok || continue
+ echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
+ echo -n ".$charset"; \
+ echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
+ echo -n '...'; \
+ if [ -f $LOCALES/$locale ]; then input=$locale; else \
+ input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
+ localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
+ echo ' done'; \
+done < $LOCALEGEN
+echo "Generation complete."