-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathtransifex-pull
executable file
·39 lines (32 loc) · 1.29 KB
/
transifex-pull
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
#!/bin/bash
# Usage: [language]
# If language is given only that language will be downloaded from transifex.
# If no language is given all languages will be downloaded from transifex.
if [ -r .transifex-user ] ; then
USERNAME=$(< .transifex-user)
else
read -p "Username [$USER]: " USERNAME
echo ${USERNAME:=$USER} > .transifex-user
fi
PASSWORD=
if [ -n "$1" ] ; then
LANGUAGES="$1"
else
echo Enter your password once or skip this and enter your password for every file.
read -p "Password:" -s PASSWORD
echo
[ -n "$PASSWORD" ] && PASSWORD=":$PASSWORD"
echo Collecting all languages...
LANGUAGES=$(curl -s -L --user "$USERNAME$PASSWORD" -X GET "http://www.transifex.com/api/2/project/light-locker/languages/" | jshon -a -e "language_code" -u)
echo Downloading pot file...
curl -L --user "$USERNAME$PASSWORD" -X GET "http://www.transifex.com/api/2/project/light-locker/resource/light-lockerpot/content/?file" -o "po/light-locker.pot"
fi
for L in $LANGUAGES ; do
echo "Downloading language $L..."
curl -L --user "$USERNAME$PASSWORD" -X GET "http://www.transifex.com/api/2/project/light-locker/resource/light-lockerpot/translation/$L/?file" -o "po/$L.po"
done
cat > po/LINGUAS << EOF
# please keep this list sorted alphabetically
#
EOF
ls po/*.po | sed 's@^po/@@;s@\.po$@@' >> po/LINGUAS