2 # Shell script to download the latest translations for a given GStreamer
3 # package from translationproject.org
6 # DOMAINS based on http://translationproject.org/extra/matrix.html
7 # We need to check all domains, not only po/LINGUAS, since there might be
10 "af am ar az be bg pt_BR bs ca zh_CN cs cy da de el eo es et eu fa fi fr "\
11 "ga en_GB gl gu he hi zh_HK hr hu id is it ja ko ku ky lg lt lv mk mn ms "\
12 "mt nb ne nl nn or pa pl pt rm ro ru rw sk sl sq sr sv ta tq th tk "\
13 "tr zh_TW uk ven vi wa xh zu"
15 # for testing/debugging:
16 #DOMAINS="es fr hu sv pl xx"
18 # check for 'diff' program
19 if ! diff --version 2>/dev/null >/dev/null; then
20 echo "==== You must have the 'diff' program installed for this script ===="
24 # check for 'wget' program
25 if ! wget --version 2>/dev/null >/dev/null; then
26 echo "==== You must have the 'wget' program installed for this script ===="
30 # make sure we're in the top-level directory
31 if [ ! -d ./po ]; then
32 echo "==== No ./po directory in the current working directory ===="
36 # make sure a package argument was passed to us
38 echo "Usage: $0 PACKAGE, e.g. $0 gst-plugins-good"
42 if test "$1" != "gstreamer" -a \
43 "$1" != "gst-plugins-base" -a \
44 "$1" != "gst-plugins-good" -a \
45 "$1" != "gst-plugins-ugly" -a \
46 "$1" != "gst-plugins-bad"; then
47 echo "Unexpected package '$1' ?!"
56 echo "Downloading latest translation files for package $PACKAGE ..."
61 PACKAGE_PO_URL_BASE="http://translationproject.org/latest/$PACKAGE"
62 PO_URL="$PACKAGE_PO_URL_BASE/$d.po"
63 PO_FILENAME="$PACKAGE.$d.po"
64 if ! wget -q -O $PO_FILENAME $PO_URL 2>/dev/null >/dev/null; then
66 echo "$d.po: failure (does probably not exist)"
68 if [ -f "po/$d.po" ]; then
69 # ./po/foo.po exists, so let's check if ours matches the latest from the
70 # translation project website
71 if diff $PO_FILENAME "po/$d.po" >/dev/null; then
72 echo "$d.po: up-to-date"
75 mv $PO_FILENAME "po/$d.po"
77 DOMAINS_UPDATED="$DOMAINS_UPDATED $d"
80 # ./po/foo.po does exists, but foo.po exists on the translation project
81 # website, so it's probably a new translation
82 echo "$d.po: new language"
83 mv $PO_FILENAME "po/$d.po"
84 DOMAINS_UPDATED="$DOMAINS_UPDATED $d"
85 DOMAINS_TO_ADD="$DOMAINS_TO_ADD $d"
90 if [ -n "$DOMAINS_UPDATED" ]; then
91 echo "===================================================================="
93 echo "Language domains updated :$DOMAINS_UPDATED"
94 echo "Language domains to cvs add :$DOMAINS_TO_ADD"
96 echo "Source: http://translationproject.org/latest/$PACKAGE/"
98 if [ -n "$DOMAINS_TO_ADD" ]; then
100 for d in $DOMAINS_TO_ADD; do
101 CMD_STRING="$CMD_STRING po/$d.po"
110 echo "===================================================================="