#!/bin/bash # Check that we have the required parameters if [ $# -ne 2 ] then echo " Usage: ./translations.sh " echo "Example: ./translations.sh it /home/john/syger/work/clients/syger/sites/all" exit 1 fi root=/home/john/syger/work/tools/drupal-6.x/translations/$1 echo 'Translating Drupal' $2 '<-' $root/modules/drupal.tgz tar -C $2 -xzf $root/modules/drupal.tgz if [ $? -ne 0 ] then echo '** Failed to extract archive' $root/modules/drupal.tgz '->' $2 fi module_directories=`ls $2/sites/*/modules -d1` for directory in $module_directories do echo 'directory' $directory dir_length=`expr length $directory + 1` module_list=`ls $directory/* -d1` for module in $module_list do module_name=${module:dir_length} test -f $root/modules/$module_name.tgz if [ $? -ne 0 ] then echo '** No translation for' $directory $module_name else echo 'Translating' $directory $module_name '<-' $root/modules/$module_name.tgz tar -C $module -xzf $root/modules/$module_name.tgz if [ $? -ne 0 ] then echo '** Failed to extract archive' $root/modules/$module_name.tgz '->' $module fi fi done done # fix the bugs in the archived translations (file permissions and dates) find $2 -name *.po -type f -exec chmod 644 \{\} \; find $2 -name *.po -type f -exec touch \{\} \;