forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlang-cleanup.sh
More file actions
executable file
·48 lines (43 loc) · 1.12 KB
/
lang-cleanup.sh
File metadata and controls
executable file
·48 lines (43 loc) · 1.12 KB
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
#!/bin/sh
#
# vim: expandtab sw=4 ts=4 sts=4:
#
# Script for removing language selection from phpMyAdmin
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
if [ $# -lt 1 ] ; then
echo "Usage: lang-cleanup.sh type"
echo "Type can be one of:"
echo " all-languages - nothing will be done"
echo " source - nothing will be done"
echo " english - no translations will be kept"
echo " langcode - keeps language"
echo
echo "Languages can be specified multiple times"
exit 1
fi
# Expression for find
match=""
for type in "$@" ; do
case $type in
all-languages|source)
exit 0
;;
english)
rm -rf po
rm -rf locale
exit 0
;;
*)
match="$match -and -not -name $type.po -and -not -path locale/$type/LC_MESSAGES/phpmyadmin.mo"
;;
esac
done
# Delete unvanted languages
find po locale -type f $match -print0 | xargs -0r rm
# Delete empty directories
rmdir --ignore-fail-on-non-empty locale/*/*
rmdir --ignore-fail-on-non-empty locale/*