-
Notifications
You must be signed in to change notification settings - Fork 33
/
bw-dev
executable file
·54 lines (49 loc) · 1.87 KB
/
bw-dev
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
53
54
#!/bin/bash
# exit on errors
set -e
CMD=$1
if [ -n "$CMD" ]; then
shift
fi
# show commands as they're executed
set -x
case "$CMD" in
site:compile)
python3 generate.py
;;
site:serve)
cd site
python3 -m http.server 8080
;;
messages:generate)
mkdir -p locale/$@/LC_MESSAGES && touch locale/$@/LC_MESSAGES/messages.po
xgettext --no-wrap --join-existing --language=C --from-code=UTF-8 --keyword=_ --output=locale/$@/LC_MESSAGES/messages.po `find templates -name "*.html"`
sed -i -e "s/Content-Type: text\/plain; charset=CHARSET/Content-Type: text\/plain; charset=UTF-8/g" locale/$@/LC_MESSAGES/messages.po
;;
messages:compile)
msgfmt locale/$@/LC_MESSAGES/messages.po -o locale/$@/LC_MESSAGES/messages.mo
;;
messages:update)
git fetch origin l10n_main:l10n_main
declare -a locales=("de_DE" "es_ES" "gl_ES" "it_IT" "fi_FI" "fr_FR" "lt_LT" "no_NO" "pl_PL" "pt_PT" "pt_BR" "ro_RO" "sv_SE" "en_Oulipo" "zh_Hans")
for locale in "${locales[@]}"; do
git checkout l10n_main locale/$locale
msgfmt locale/$locale/LC_MESSAGES/messages.po -o locale/$locale/LC_MESSAGES/messages.mo
done
xgettext --no-wrap --join-existing --language=C --from-code=UTF-8 --keyword=_ --output=locale/en_US/LC_MESSAGES/messages.po `find templates -name "*.html"`
sed -i -e "s/Content-Type: text\/plain; charset=CHARSET/Content-Type: text\/plain; charset=UTF-8/g" locale/en_US/LC_MESSAGES/messages.po
;;
black)
black .
;;
*)
set +x # No need to echo echo
echo "Unrecognised command. Try:"
echo " site:compile"
echo " site:serve"
echo " messages:generate [locale]"
echo " messages:compile [locale]"
echo " messages:update"
echo " black"
;;
esac