source: other-projects/gti/translation_status.sh@ 28490

Last change on this file since 28490 was 28490, checked in by ak19, 11 years ago

Committing two new scripts for processing translations, and a spelling correction to a third script. The new scripts are: 1. remove_extra_lines.sh, which is a modified version of the one Lan gave me and which strips lines that mention 'Missing translation' and 'Updated date by name'. This one makes sure not to leave empty lines behind after removing lines that only contained 'Missing translation' messages. 2. translation_status.sh, mainly to be used on nzdl's GTI installation, this script should be called by the cron to send off an email if any of the translation files in macros, gli/help, gli/classes, perllib or gsinstaller have been modified. This is needed to alert us if any translator used the GTI to update translations on nzdl. This script will send us an email. Upon receipt, we should locally process those files on nzdl that were updated by passing them through the remove_extra_lines.sh script, then commit the result to svn, and finally replace the ones on nzdl's GTI installation with the one committed to svn.

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#! /bin/bash
2
3[email protected]
4
5# get rid of any old reports
6report=translation_status_report.txt
7if test -f $report; then
8 rm -f $report
9fi
10
11filelisting=("macros/*.dm" "perllib/strings*.properties" "gli/classes/dictionary*.properties" "gli/help/" "gsinstaller/LanguagePack*.properties")
12
13date=`date +"%d-%m-%y"`
14echo "Translation status report for date: $date" >> $report
15echo "Checked in ${filelisting[@]}" >> $report
16echo "---------------------------------------------" >> $report
17
18# store backup of Internal Field Separator value, then set IFS to newline for splitting on newline
19IFS_BAK=$IFS
20# IFS='\n' # splits on all whitespace
21IFS='
22'
23
24num_modified=0
25
26# in the lines returned from the diff, test for archives or newline
27# http://stackoverflow.com/questions/229551/string-contains-in-bash
28# http://stackoverflow.com/questions/10515964/counter-increment-in-bash-loop-not-working
29for file in ${filelisting[@]}; do
30 status=`svn status $file`
31 # "LINE: $file - status: $status"
32 # if the file's svn status is modified, write the filename out to the report
33 if [[ "$status" == *"M "* ]]; then
34 #echo "$file has been modified: $status"
35 echo $file >> $report
36 ((num_modified++))
37 fi
38done
39
40# restore IFS
41IFS=$IFS_BAK
42IFS_BAK=
43
44if [[ $num_modified == 0 ]]; then
45 echo "No files modified" >> $report
46else
47 echo ""
48 echo "The above files were modified ($num_modified number of files)." >> $report
49fi
50
51echo "---------------------------------------------" >> $report
52
53# if no files are modified, we don't send email, otherwise we do
54if [[ $num_modified != 0 ]]; then
55# echo "Files were modified. Sending email..."
56 cat $report | mail -s 'TRANSLATION files on nzdl have been updated' $GREENSTONE_EMAIL
57fi
Note: See TracBrowser for help on using the repository browser.