forked from group-butler/GroupButler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch.sh
executable file
·48 lines (43 loc) · 1000 Bytes
/
launch.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
#!/usr/bin/env bash
make_template() {
find . -name "*.lua" | sort |
xgettext --from-code=utf-8 \
--add-comments=TRANSLATORS \
--package-name=GroupButler \
--package-version=4.2 \
--msgid-bugs-address=https://telegram.me/baconn \
--force-po \
--keyword=i18n \
--files-from=/dev/stdin \
--output=/dev/stdout
}
case $1 in
bot | "")
sed -i -E 's/\r$//' .env # Converting CRLF (\r\n) to LF (\n)
source .env && export $(cut -d= -f1 .env)
while true; do
./polling.lua
sleep 10
done
;;
create-locale)
if [ -z "$2" ]; then
echo "Using: $0 $1 <locale_name>" >&2
elif [ -a locales/$2.po ]; then
echo "Locale exists" >&2
else
make_template | msginit --locale=$2 \
--input=/dev/stdin \
--output-file=locales/$2.po
fi
exit
;;
update-locale)
if [ -z "$2" ]; then
echo "Using: $0 $1 <locale_name>" >&2
else
make_template | msgmerge --update locales/$2.po /dev/stdin
fi
exit
esac
echo "Using: $0 [ bot | create-locale | update-locale ]" >&2