Contents of /trunk/glibc/locale-gen
Parent Directory | Revision Log
Revision 109 -
(show annotations)
(download)
Sat Mar 17 18:01:48 2007 UTC (17 years, 6 months ago) by niro
File size: 1044 byte(s)
Sat Mar 17 18:01:48 2007 UTC (17 years, 6 months ago) by niro
File size: 1044 byte(s)
new file from http://cvs.archlinux.org arch linux rev 1.1
1 | #!/bin/sh |
2 | |
3 | set -e |
4 | |
5 | LOCALEGEN=/etc/locale.gen |
6 | LOCALES=/usr/share/i18n/locales |
7 | if [ -n "$POSIXLY_CORRECT" ]; then |
8 | unset POSIXLY_CORRECT |
9 | fi |
10 | |
11 | |
12 | [ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0; |
13 | |
14 | # Remove all old locale dir and locale-archive before generating new |
15 | # locale data. |
16 | rm -rf /usr/lib/locale/* || true |
17 | |
18 | umask 022 |
19 | |
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 |
26 | fi |
27 | } |
28 | |
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." |