SVN commit 1003762 by sngeorgaras: added compendium support to l10n-find-new M +1 -1 l10n-create-compendium M +122 -106 l10n-find-new --- trunk/www/areas/l10n/teams/el/scripts/l10n-create-compendium #1003761:1003762 @@ -45,7 +45,7 @@ # echo -n "Working in ${POS[$n]}... " cd "${POS[$n]}" rm -rf "$TMP"/test.po 2>/dev/null - msgcat --use-first -u `find . -name "*.po"` |msgattrib --translated --no-fuzzy --no-obsolete -o "${T[$n]}" + msgcat --use-first -u `find . -name "*.po"` |msgattrib --translated --no-fuzzy --no-obsolete --no-location -o "${T[$n]}" # echo "done" n=$(($n+1)) done --- trunk/www/areas/l10n/teams/el/scripts/l10n-find-new #1003761:1003762 @@ -18,24 +18,25 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # function help(){ - echo -n \"$(basename "$0")\" - echo " scans the local copy of KDE SVN + echo -n \"$(basename "$0")\" + echo " scans the local copy of KDE SVN repository and finds the po files that have been created at KDE SVN (remotely), but don't exist in the local copy" - echo - echo "New po files will be added to the local copy + echo + echo "New po files will be added to the local copy of the repository and the remote repository itself (if user is aythorized to commit) " - echo -n "Usage: " - echo -n $(basename "$0") - echo " [options]" - echo - echo "Valid options are:" - echo " -r report only (take no action)" - echo " -n execute no sanity checks" - echo " -h display this screen and exit" - echo + echo -n "Usage: " + echo -n $(basename "$0") + echo " [options]" + echo + echo "Valid options are:" + echo " -r report only (take no action)" + echo " -c [file] use compendium file [file]" + echo " -n execute no sanity checks" + echo " -h display this screen and exit" + echo } @@ -43,108 +44,123 @@ # # Copy this to all scripts if [ -e "$HOME"/.l10n.conf ];then - . "$HOME"/.l10n.conf - if [ -z "$installFolder" ];then - echo `basename "$0"`"> Error: parameter installFolder not set..." - echo `basename "$0"`"> Please edit ~/.l10n.conf" - echo - exit 1 - fi - if [ ! -d "$installFolder" ];then - echo `basename "$0"`"> Error: parameter \"installFolder\"" - echo `basename "$0"`"> Value: \"$installFolder\"" - echo `basename "$0"`" Does not exist or is not a folder" - echo `basename "$0"`"> Please edit ~/.l10n.conf" - echo - exit 1 - fi - if [ ! -r "$installFolder" ];then - echo `basename "$0"`"> Error: parameter \"installFolder\"" - echo `basename "$0"`"> Value: \"$installFolder\"" - echo `basename "$0"`" No read permission to this folder" - echo `basename "$0"`"> Please edit ~/.l10n.conf" - echo - exit 1 - fi - . "$installFolder"/l10n-common - parceConfig - errorDetected=$? + . "$HOME"/.l10n.conf + if [ -z "$installFolder" ];then + echo `basename "$0"`"> Error: parameter installFolder not set..." + echo `basename "$0"`"> Please edit ~/.l10n.conf" + echo + exit 1 + fi + if [ ! -d "$installFolder" ];then + echo `basename "$0"`"> Error: parameter \"installFolder\"" + echo `basename "$0"`"> Value: \"$installFolder\"" + echo `basename "$0"`" Does not exist or is not a folder" + echo `basename "$0"`"> Please edit ~/.l10n.conf" + echo + exit 1 + fi + if [ ! -r "$installFolder" ];then + echo `basename "$0"`"> Error: parameter \"installFolder\"" + echo `basename "$0"`"> Value: \"$installFolder\"" + echo `basename "$0"`" No read permission to this folder" + echo `basename "$0"`"> Please edit ~/.l10n.conf" + echo + exit 1 + fi + . "$installFolder"/l10n-common + parceConfig + errorDetected=$? else - echo `basename "$0"`"> Error: ~/.l10n.conf - Not found" - echo "A sample l10n.conf file can be found at + echo `basename "$0"`"> Error: ~/.l10n.conf - Not found" + echo "A sample l10n.conf file can be found at ftp://ftp.i18n.kde.org/teams/el/scripts" - echo - exit 1 + echo + exit 1 fi # End copy # reportOnly=0 -while getopts ":vhnr" Option +while getopts ":vhnrc:" Option do - case $Option in - r) reportOnly=1;; - h) # show help - help - exit 0;; - n) # run no checks - runCheck=false;; - v) # show version - showVersion 'S. Georgaras ' - echo - exit 0 - esac + case $Option in + c) useCompendium=true + compendium="$OPTARG" + if [ ! -r "$compendium" ];then + echo " Error: Compendium file does not exit (or is not readable)" + exit 1 + fi + ;; + r) reportOnly=1;; + h) # show help + help + exit 0;; + n) # run no checks + runCheck=false;; + v) # show version + showVersion 'S. Georgaras ' + echo + exit 0 + esac done + shift $(($OPTIND - 1)) for n in "$POT_STABLE" "$POT_TRUNK" do - cd "$n" - echo "Checking \"$n\"" - for k in `find . -name "*.pot"` - do - chPOT=`echo "$k" | sed 's|^\./||'` - tmp=`dirname "$chPOT"` - if [ "$tmp" != "" ] && [ "$tmp" != "." ];then - tmp=`echo "$n" | grep stable` - if [ "$tmp" = "" ];then - chDir="$PO_TRUNK" - else - chDir="$PO_STABLE" - fi - chPO=`echo "$chDir"/"$chPOT" | sed 's|t$||'` - if [ ! -e "$chPO" ];then - echo " File \"$(basename $(dirname $chPO))/$(basename $chPO)\" has been added to KDE SVN..." - if [ $reportOnly -eq 0 ];then - poDir=$(dirname "$chPO") - addDir=0 - if [ ! -d "$poDir" ];then - mkdir -p "$poDir" - if [ ! -d "$poDir" ];then - echo " Cannot create folder \"$poDir\"" - echo " The file will NOT be added in local copy" - continue - else - addDir=1 - fi - fi - cp "$n"/"$chPOT" "$chPO" - comeBack="$PWD" - cd $(dirname "$chPO");cd .. - canRemove=`svn info |grep URL | sed 's|^URL: ||' | grep "$svnURL"` - if [ $addDir -eq 0 ];then - if [ "$canRemove" != "" ];then - echo -n " " - svn add "$(basename $(dirname $chPO))/$(basename $chPO)" && echo "File added on $(date): $chPO" >> "$tmpFolder"/auto-actions.log - fi - else - if [ "$canRemove" != "" ];then - echo -n " " - svn add "$(basename $(dirname $chPO))" && echo "Folder added on $(date): $(dirname $chPO), containing file $(basename $chPO)" >> "$tmpFolder"/auto-actions.log - fi - fi - cd "$comeBack" - fi - fi - fi - done -done \ No newline at end of file + cd "$n" + echo "Checking \"$n\"" + for k in `find . -name "*.pot"` + do + chPOT=`echo "$k" | sed 's|^\./||'` + tmp=`dirname "$chPOT"` + if [ "$tmp" != "" ] && [ "$tmp" != "." ];then + tmp=`echo "$n" | grep stable` + if [ "$tmp" = "" ];then + chDir="$PO_TRUNK" + else + chDir="$PO_STABLE" + fi + chPO=`echo "$chDir"/"$chPOT" | sed 's|t$||'` + if [ ! -e "$chPO" ];then + echo " File \"$(basename $(dirname $chPO))/$(basename $chPO)\" has been added to KDE SVN..." + if [ $reportOnly -eq 0 ];then + poDir=$(dirname "$chPO") + addDir=0 + if [ ! -d "$poDir" ];then + mkdir -p "$poDir" + if [ ! -d "$poDir" ];then + echo " Cannot create folder \"$poDir\"" + echo " The file will NOT be added in local copy" + continue + else + addDir=1 + fi + fi + cp "$n"/"$chPOT" "$chPO" + if test "useCompendium";then + echo -n " Merging translations... " + msgmerge -C "$compendium" "$chPO" "$n"/"$chPOT" -o "$chPO".tmp + mv "$chPO".tmp "$chPO" + fi + comeBack="$PWD" + cd $(dirname "$chPO");cd .. + canRemove=`svn info |grep URL | sed 's|^URL: ||' | grep "$svnURL"` + if [ $addDir -eq 0 ];then + if [ "$canRemove" != "" ];then + echo -n " " + svn add "$(basename $(dirname $chPO))/$(basename $chPO)" && echo "File added on $(date): $chPO" >> "$tmpFolder"/auto-actions.log + fi + else + if [ "$canRemove" != "" ];then + echo -n " " + svn add "$(basename $(dirname $chPO))" && echo "Folder added on $(date): $(dirname $chPO), containing file $(basename $chPO)" >> "$tmpFolder"/auto-actions.log + fi + fi + cd "$comeBack" + fi + fi + fi + done +done + +# for n in `svn st | sed 's|^A *||'`;do svn --force remove "$n";done