-
Notifications
You must be signed in to change notification settings - Fork 8
/
lang.sh
executable file
·45 lines (37 loc) · 950 Bytes
/
lang.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
TRANS_DIR=translations
BABEL_CFG=$TRANS_DIR/babel.cfg
MSG_POT=$TRANS_DIR/messages.pot
case "$1" in
init)
if [ -f $MSG_POT ]
then
echo $"$MSG_POT already exists, run update instead"
exit 1
fi
pybabel extract -F $BABEL_CFG -k lazy_gettext -o $MSG_POT .
;;
new)
if [ -n "$2" ]
then
echo $"Usage: $0 $1 {{langcode}}"
exit 1
fi
LANG_DIR=$TRANS_DIR/$2
if [ -d $LANG_DIR ]
then
echo $"$2 has already been created"
exit 1
fi
pybabel init -i $MSG_POT -d $TRANS_DIR -l $2
;;
compile)
pybabel compile -d $TRANS_DIR
;;
update)
pybabel extract -F $BABEL_CFG -k lazy_gettext -o $MSG_POT .
pybabel update -i $MSG_POT -d $TRANS_DIR
;;
*)
echo $"Usage: $0 {{init|new|translate|update}}"
exit 1
esac