2009-11-12 20:58:03 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2009-11-12 21:48:04 +00:00
|
|
|
# Automate the compilation of the various locale PO files by automatically
|
|
|
|
# generating them at night.
|
2009-11-12 22:19:36 +00:00
|
|
|
#
|
2009-11-12 21:48:04 +00:00
|
|
|
projname=boinctrunk
|
|
|
|
projdir=$HOME/pootle/po/$projname
|
|
|
|
|
2009-11-12 22:19:36 +00:00
|
|
|
cd $projdir
|
2009-11-12 21:48:04 +00:00
|
|
|
|
2010-02-18 20:57:13 +00:00
|
|
|
|
|
|
|
# Update anything that needs updating
|
|
|
|
svn update
|
|
|
|
|
|
|
|
|
2010-07-13 20:10:09 +00:00
|
|
|
# Iterrate through the various PO files looking for those that need to be added to SVN.
|
|
|
|
#
|
|
|
|
for file in `find -name 'BOINC-Manager.po'` ; do
|
|
|
|
dir=`dirname $file`
|
|
|
|
locale=`basename $dir`
|
|
|
|
template_name=${projdir}/${locale}/BOINC-Manager
|
|
|
|
|
|
|
|
# Add any missing PO files to SVN
|
|
|
|
svn add ${template_name}.po > /dev/null 2> /dev/null
|
2010-07-13 20:27:59 +00:00
|
|
|
svn propset svn:mime-type 'text/plain;charset=UTF-8' ${template_name}.po > /dev/null 2> /dev/null
|
2010-07-13 20:10:09 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# Iterrate through the various PO files looking for those that need to be added to SVN.
|
|
|
|
#
|
|
|
|
for file in `find -name 'BOINC-Client.po'` ; do
|
|
|
|
dir=`dirname $file`
|
|
|
|
locale=`basename $dir`
|
|
|
|
template_name=${projdir}/${locale}/BOINC-Client
|
|
|
|
|
|
|
|
# Add any missing PO files to SVN
|
|
|
|
svn add ${template_name}.po > /dev/null 2> /dev/null
|
2010-07-13 20:27:59 +00:00
|
|
|
svn propset svn:mime-type 'text/plain;charset=UTF-8' ${template_name}.po > /dev/null 2> /dev/null
|
2010-07-13 20:10:09 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
|
2009-11-12 22:19:36 +00:00
|
|
|
# Iterrate through the various PO files looking for those that need to be compiled.
|
|
|
|
#
|
|
|
|
for file in `find -name 'BOINC-Manager.po'` ; do
|
2009-11-12 20:58:03 +00:00
|
|
|
dir=`dirname $file`
|
|
|
|
locale=`basename $dir`
|
2010-02-18 20:57:13 +00:00
|
|
|
template_name=${projdir}/${locale}/BOINC-Manager
|
2009-11-12 22:19:36 +00:00
|
|
|
|
2010-02-18 20:57:13 +00:00
|
|
|
if test ${template_name}.po -nt ${template_name}.mo
|
|
|
|
then
|
2009-11-12 22:19:36 +00:00
|
|
|
|
2010-09-20 20:40:22 +00:00
|
|
|
# Compile the PO file into an MO file.
|
2010-09-20 20:42:56 +00:00
|
|
|
pocompile ${template_name}.po ${template_name}.mo
|
2009-11-12 22:19:36 +00:00
|
|
|
|
|
|
|
# Add any new MO files to SVN
|
2010-02-18 20:57:13 +00:00
|
|
|
svn add ${template_name}.mo > /dev/null 2> /dev/null
|
2009-11-12 22:19:36 +00:00
|
|
|
|
|
|
|
# Touch each file to adjust timestamps
|
2010-02-18 20:57:13 +00:00
|
|
|
touch ${template_name}.po
|
|
|
|
touch ${template_name}.mo
|
2009-11-12 22:19:36 +00:00
|
|
|
|
|
|
|
fi
|
2010-02-18 20:57:13 +00:00
|
|
|
done
|
2009-11-12 21:48:04 +00:00
|
|
|
|
2010-02-18 20:57:13 +00:00
|
|
|
|
2010-07-13 20:02:33 +00:00
|
|
|
# Iterrate through the various PO files looking for those that need to be compiled.
|
|
|
|
#
|
|
|
|
for file in `find -name 'BOINC-Client.po'` ; do
|
|
|
|
dir=`dirname $file`
|
|
|
|
locale=`basename $dir`
|
|
|
|
template_name=${projdir}/${locale}/BOINC-Client
|
|
|
|
|
|
|
|
if test ${template_name}.po -nt ${template_name}.mo
|
|
|
|
then
|
|
|
|
|
2010-09-20 20:40:22 +00:00
|
|
|
# Compile the PO file into an MO file.
|
|
|
|
pocompile ${template_name}.po ${template_name}.mo > /dev/null 2> /dev/null
|
2010-07-13 20:02:33 +00:00
|
|
|
|
|
|
|
# Add any new MO files to SVN
|
|
|
|
svn add ${template_name}.mo > /dev/null 2> /dev/null
|
|
|
|
|
|
|
|
# Touch each file to adjust timestamps
|
|
|
|
touch ${template_name}.po
|
|
|
|
touch ${template_name}.mo
|
|
|
|
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2010-02-18 20:57:13 +00:00
|
|
|
# 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
|
2010-02-18 21:04:38 +00:00
|
|
|
template_rootname=`basename $file .pot`
|
2010-02-18 21:00:47 +00:00
|
|
|
template_name=${projdir}/templates/${template_rootname}
|
2010-02-18 20:57:13 +00:00
|
|
|
|
|
|
|
# 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`
|
2010-02-18 21:04:38 +00:00
|
|
|
po_name=`basename $file .po`
|
2010-02-18 20:57:13 +00:00
|
|
|
|
2010-02-18 21:50:16 +00:00
|
|
|
msgmerge --update ${locale}/${po_name}.po templates/${po_name}.pot
|
2010-02-18 21:42:43 +00:00
|
|
|
|
2010-02-18 20:57:13 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
for file in `find -name '*.pot'` ; do
|
2010-02-18 21:04:38 +00:00
|
|
|
template_rootname=`basename $file .pot`
|
2010-02-18 21:50:16 +00:00
|
|
|
template_name=${projdir}/templates/${template_rootname}
|
2010-02-18 20:57:13 +00:00
|
|
|
|
2010-02-18 21:50:16 +00:00
|
|
|
# Touch each file to adjust timestamps
|
|
|
|
touch ${template_name}.pot
|
|
|
|
touch ${template_name}.flag
|
2010-02-18 20:57:13 +00:00
|
|
|
|
2009-11-12 22:19:36 +00:00
|
|
|
done
|
2009-11-12 21:48:04 +00:00
|
|
|
|
2009-11-12 22:42:54 +00:00
|
|
|
|
2009-11-12 22:19:36 +00:00
|
|
|
# Commit any changes to SVN
|
|
|
|
svn commit -m 'Update Translations'
|
2009-11-12 20:58:03 +00:00
|
|
|
|
|
|
|
exit 0
|