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 diff --version 2>/dev/null >/dev/null
21 echo "==== You must have the 'diff' program installed for this script ===="
25 # check for 'wget' program
26 wget --version 2>/dev/null >/dev/null
28 echo "==== You must have the 'wget' program installed for this script ===="
32 # make sure we're in the top-level directory
33 if [ ! -d ./po ]; then
34 echo "==== No ./po directory in the current working directory ===="
38 # make sure a package argument was passed to us
40 echo "Usage: $0 PACKAGE, e.g. $0 gst-plugins-good"
44 if test "$1" != "gstreamer" -a \
45 "$1" != "gst-plugins-base" -a \
46 "$1" != "gst-plugins-good" -a \
47 "$1" != "gst-plugins-ugly" -a \
48 "$1" != "gst-plugins-bad"; then
49 echo "Unexpected package '$1' ?!"
58 echo "Downloading latest translation files for package $PACKAGE ..."
63 PACKAGE_PO_URL_BASE="http://translationproject.org/latest/$PACKAGE"
64 PO_URL="$PACKAGE_PO_URL_BASE/$d.po"
65 PO_FILENAME="$PACKAGE.$d.po"
66 if wget -q -nc -O $PO_FILENAME $PO_URL; then
67 if [ -f "po/$d.po" ]; then
68 # ./po/foo.po exists, so let's check if ours matches the latest from the
69 # translation project website
70 if diff $PO_FILENAME "po/$d.po" >/dev/null; then
71 echo "$d.po: up-to-date"
74 mv $PO_FILENAME "po/$d.po"
76 DOMAINS_UPDATED="$DOMAINS_UPDATED $d"
79 # ./po/foo.po doesn't exist, but foo.po exists on the translation project
80 # website, so it's probably a new translation
81 echo "$d.po: new language"
82 mv $PO_FILENAME "po/$d.po"
83 DOMAINS_UPDATED="$DOMAINS_UPDATED $d"
84 DOMAINS_TO_ADD="$DOMAINS_TO_ADD $d"
88 echo "$d.po: failure (does probably not exist)"
92 if [ -n "$DOMAINS_UPDATED" ]; then
93 echo "===================================================================="
95 echo "Language domains updated :$DOMAINS_UPDATED"
96 echo "Language domains to cvs add :$DOMAINS_TO_ADD"
98 echo "Source: http://translationproject.org/latest/$PACKAGE/"
100 if [ -n "$DOMAINS_TO_ADD" ]; then
102 for d in $DOMAINS_TO_ADD; do
103 CMD_STRING="$CMD_STRING po/$d.po"
109 echo "now and add the following domains to the po/LINGUAS file:"
111 echo " $DOMAINS_TO_ADD"
115 echo "===================================================================="