diff --git a/checkin_notes b/checkin_notes index 4458b0e0cb..db963507f4 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1273,3 +1273,10 @@ David 18 Feb 2010 samples/wrapper/ wrapper.cpp + +Rom 18 Feb 2010 + - locale: automatically update each language based on whatever the + new template has. + + locale/ + updatetrans.sh diff --git a/locale/updatetrans.sh b/locale/updatetrans.sh index f25ba408d0..f868d79ab5 100755 --- a/locale/updatetrans.sh +++ b/locale/updatetrans.sh @@ -8,20 +8,24 @@ projdir=$HOME/pootle/po/$projname cd $projdir + +# Update anything that needs updating +svn update + + # Iterrate through the various PO files looking for those that need to be compiled. # for file in `find -name 'BOINC-Manager.po'` ; do dir=`dirname $file` locale=`basename $dir` + template_name=${projdir}/${locale}/BOINC-Manager - timestampPO=`date -r ${projdir}/${locale}/BOINC-Manager.po` - timestampMO=`date -r ${projdir}/${locale}/BOINC-Manager.mo` - - if [ "${timestampPO}" != "${timestampMO}" ]; then + # Remove old MO from previous compilation + # + rm ${projdir}/BOINC-Manager.mo > /dev/null 2> /dev/null - # Remove old MO from previous compilation - # - rm ${projdir}/BOINC-Manager.mo > /dev/null 2> /dev/null + if test ${template_name}.po -nt ${template_name}.mo + then # Use wget to cause the Pottle system to compile the PO file into an MO file. # @@ -32,24 +36,79 @@ for file in `find -name 'BOINC-Manager.po'` ; do wget http://boinc.berkeley.edu/translate/${locale}/${projname}/BOINC-Manager.mo > /dev/null 2> /dev/null # Add any new MO files to SVN - svn add ${projdir}/${locale}/BOINC-Manager.mo > /dev/null 2> /dev/null + svn add ${template_name}.mo > /dev/null 2> /dev/null # Touch each file to adjust timestamps - touch ${projdir}/${locale}/BOINC-Manager.po - touch ${projdir}/${locale}/BOINC-Manager.mo + touch ${template_name}.po + touch ${template_name}.mo + + fi +done + + +# Determine if we need to update the various languages using the templates. +# This will be done by the use of a tag file which should have a matching +# timestamp as the template files. If the timestamps do not match update all +# languages. +for file in `find -name '*.pot'` ; do + template_rootname=`basename $file` + template_name=${projdir}/${locale}/${template_rootname} + + # Check to see if the file exists, if not create it + if test ! -e ${template_name}.flag + then + cp ${template_name}.pot ${template_name}.flag + fi + + # If the modification timestamps don't match then update all the languages + if test ${template_name}.pot -nt ${template_name}.flag + then + execute_update=true + fi +done + +if test "${execute_update}" = "true" +then + + for file in `find -name '*.po'` ; do + dir=`dirname $file` + locale=`basename $dir` + po_name=`basename $file` + + # Remove old index.html from previous iteration + # + rm ${projdir}/index.html > /dev/null 2> /dev/null + + if test ${template_name}.po -nt ${template_name}.mo + then + + # Use wget to cause the Pottle system to update the po file based on the template. + # + # Example: http://boinc.berkeley.edu/translate/ar/boinctrunk/index.html?editing=1&doupdate=1&updatefile=BOINC-Manager.po + # + wget http://boinc.berkeley.edu/translate/${locale}/${projname}/index.html?editing=1&doupdate=1&updatefile=${po_name}.po > /dev/null 2> /dev/null + + fi + done + +fi + +for file in `find -name '*.pot'` ; do + template_rootname=`basename $file` + template_name=${projdir}/${locale}/${template_rootname} + + if test ${template_name}.pot -nt ${template_name}.flag + then + + # Touch each file to adjust timestamps + touch ${template_name}.pot + touch ${template_name}.flag fi - done -# Remove old MO from previous compilation -# -rm ${projdir}/BOINC-Manager.mo > /dev/null 2> /dev/null # Commit any changes to SVN svn commit -m 'Update Translations' -# Update anything that needs updating -svn update - exit 0