forked from eiskaltdcpp/eiskaltdcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-translations.sh
executable file
·146 lines (106 loc) · 3.44 KB
/
update-translations.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#! /bin/bash
# Author: Boris Pek <[email protected]>
# License: Public Domain
# Created: 2011-11-26
# Updated: 2013-06-26
# Version: N/A
if [[ ${0} =~ ^/.+$ ]]; then
export CUR_DIR="$(dirname ${0})"
else
export CUR_DIR="${PWD}/$(dirname ${0})"
fi
export MAIN_DIR="${CUR_DIR}/.."
cd "${CUR_DIR}" || exit 1
case "${1}" in
"up")
git pull --all || exit 1
;;
"cm")
git commit -a -m 'Translations were updated from Transifex.' || exit 1
;;
"make")
if [ -d "${CUR_DIR}/builddir" ]; then
cd "${CUR_DIR}/builddir" || exit 1
make translations_qt mo-update || exit 1
else
mkdir -p builddir && cd builddir || exit 1
cmake -DUSE_QT=ON -DUSE_GTK=ON .. || exit 1
"${0}" make || exit 1
fi
;;
"tr")
# Test Internet connection:
host transifex.net > /dev/null || exit 1
git status || exit 1
LANG_DIR="${MAIN_DIR}/eiskaltdcpp_transifex"
cd "${LANG_DIR}" || exit 1
tx pull -a -s || exit 1
cd "${LANG_DIR}/translations/eiskaltdcpp.dcpp" || exit 1
cp *.po "${CUR_DIR}/dcpp/po/" || exit 1
cd "${LANG_DIR}/translations/eiskaltdcpp.eiskaltdcpp-gtk" || exit 1
cp *.po "${CUR_DIR}/eiskaltdcpp-gtk/po/" || exit 1
cd "${LANG_DIR}/translations/eiskaltdcpp.eiskaltdcpp-qt" || exit 1
cp *.ts "${CUR_DIR}/eiskaltdcpp-qt/translations/" || exit 1
cd "${CUR_DIR}" || exit 1
git status || exit 1
;;
"tr_up")
cd "${CUR_DIR}" || exit 1
export QT_SELECT=qt4
lupdate eiskaltdcpp-qt/translations.pro || exit 1
cd builddir && make pot-update || exit 1
cp -fa dcpp/po/libeiskaltdcpp.pot dcpp/po/en.po
cp -fa eiskaltdcpp-gtk/po/eiskaltdcpp-gtk.pot eiskaltdcpp-gtk/po/en.po
git status || exit 1
;;
"tr_cl")
cd "${CUR_DIR}" || exit 1
export QT_SELECT=qt4
lupdate -verbose -no-obsolete eiskaltdcpp-qt/translations.pro || exit 1
cd builddir && make pot-update || exit 1
cp -fa dcpp/po/libeiskaltdcpp.pot dcpp/po/en.po
cp -fa eiskaltdcpp-gtk/po/eiskaltdcpp-gtk.pot eiskaltdcpp-gtk/po/en.po
git status || exit 1
;;
"tr_push")
LANG_DIR="${MAIN_DIR}/eiskaltdcpp_transifex"
cd "${LANG_DIR}/translations" || exit 1
cp "${CUR_DIR}"/dcpp/po/*.po eiskaltdcpp.dcpp/ || exit 1
cp "${CUR_DIR}"/eiskaltdcpp-gtk/po/*.po eiskaltdcpp.eiskaltdcpp-gtk/ || exit 1
cp "${CUR_DIR}"/eiskaltdcpp-qt/translations/*.ts eiskaltdcpp.eiskaltdcpp-qt/ || exit 1
cd "${LANG_DIR}" || exit 1
if [ -z "${2}" ]; then
echo "<arg> is not specified!" ; exit 1
elif [ "${2}" = "src" ] ; then
tx push -s || exit 1
elif [ "${2}" = "all" ] ; then
tx push -s -t || exit 1
else
tx push -t -l ${2} || exit 1
fi
;;
"tr_co")
if [ -d "${MAIN_DIR}/eiskaltdcpp_transifex" ]; then
echo "${MAIN_DIR}/eiskaltdcpp_transifex"
echo "directory already exists!"
else
echo "Creating ${MAIN_DIR}/eiskaltdcpp_transifex"
mkdir -p "${MAIN_DIR}/eiskaltdcpp_transifex/.tx"
cp "transifex.config" "${MAIN_DIR}/eiskaltdcpp_transifex/.tx/config" || exit 1
cd "${MAIN_DIR}/eiskaltdcpp_transifex" || exit 1
tx pull -a -s || exit 1
fi
;;
*)
echo "Usage:"
echo " up cm make"
echo " tr tr_up tr_cl tr_co"
echo " tr_push <arg> (arg: src, all or language)"
echo ;
echo "Examples:"
echo " ./update-translations.sh tr_push src"
echo " ./update-translations.sh tr_push all"
echo " ./update-translations.sh tr_push ru"
;;
esac
exit 0