-
Notifications
You must be signed in to change notification settings - Fork 7
/
add.sh
executable file
·52 lines (44 loc) · 1.34 KB
/
add.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/sh
# This will add the locale en_NL.
if [ `id -u` -ne 0 ]; then
echo "ERROR: Please run this script as root"
exit 1
fi
# add locale
if [ -d /usr/share/i18n/locales/ ]; then
cp -f en_NL /usr/share/i18n/locales/
else
echo "ERROR: No /usr/share/i18n/locales/ directory, install package locales or glibc-i18ndata"
exit 1
fi
# register locale
if [ -f /etc/locale.gen ]; then
if [ `grep ^en_NL /etc/locale.gen|wc -l` -eq 0 ]; then
echo "en_NL.UTF-8 UTF-8" >> /etc/locale.gen
fi
# regenerate locales
locale-gen
# update Xlib database (see https://xyne.dev/projects/locale-en_xx/#usage)
file=/usr/share/X11/locale/locale.dir
if [ -f $file ] && [ `grep en_NL $file|wc -l` -eq 0 ]; then
echo >> $file
echo "en_US.UTF-8/XLC_LOCALE en_NL.UTF-8" >> $file
echo "en_US.UTF-8/XLC_LOCALE: en_NL.UTF-8" >> $file
fi
file=/usr/share/X11/locale/compose.dir
if [ -f $file ] && [ `grep en_NL $file|wc -l` -eq 0 ]; then
echo >> $file
echo "en_US.UTF-8/Compose en_NL.UTF-8" >> $file
echo "en_US.UTF-8/Compose: en_NL.UTF-8" >> $file
fi
# regenerate locales
locale-gen
#TODO where to use the following lines?
#elif [ -x /usr/bin/localedef ]; then
# /usr/bin/localedef -f UTF-8 -i en_NL en_NL.UTF-8
#else
# echo "ERROR: Do not know how to register locale"
# exit 1
#fi
# list locale
locale -a|grep en_NL