From d2e60379ebeb1c95ad006d9e9ba90fda57be749a Mon Sep 17 00:00:00 2001 From: filip Date: Sat, 7 Dec 2013 19:14:33 +0100 Subject: print of versions and some changes for easier work with multiple language codes added print of script and database version rename working_translations_directory in generated configuration file and list_of_resources_for_translation_$language_code.txt to be more suitable for work with multiple language codes --- check_for_translation_work.sh | 70 ++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 34 deletions(-) (limited to 'check_for_translation_work.sh') diff --git a/check_for_translation_work.sh b/check_for_translation_work.sh index 31efb83d..a267fb2e 100755 --- a/check_for_translation_work.sh +++ b/check_for_translation_work.sh @@ -7,7 +7,7 @@ # # Filip Komar, 2012, 2013 # Remco Rijnders, 2012 -# $Id: check_for_translation_work.sh 2013-12-05 14:49:00 UTC filip $ +# $Id: check_for_translation_work.sh 2013-12-07 18:07:00 UTC filip $ # # Please see git for a list of changes to this script. # @@ -24,7 +24,7 @@ language_code=xx # please make sure those directories exist before running the script!!! svn_directory="/home/user/Mageia/i18n/svn" git_directory="/home/user/Mageia/i18n/git" # added after git transition -working_translations_directory="/home/user/Mageia/i18n/translations" +working_translations_directory="/home/user/Mageia/i18n/translations/$language_code" # choose svn method: # 1. anonymous (no commit access) @@ -78,7 +78,7 @@ check_pot_syntax=0 copy_options="-ivur" # choose log filename -log_filename="updated_translations_in_git" +log_filename="updated_translations_in_git_$language_code" log_directory="$git_directory" logfile="$git_directory/$log_filename" @@ -140,8 +140,8 @@ if [ ! -f ~/.gitconfig ]; then [push] default = matching EOF - echo "It seems that you didn't configured git yet" > "$log_directory"/list_of_resources_for_translation.txt - echo "Please edit ~/.gitconfig See: https://wiki.mageia.org/en/Git_usage_for_l10n_and_doc" > "$log_directory"/list_of_resources_for_translation.txt + echo "It seems that you didn't configured git yet" > "$log_directory"/list_of_resources_for_translation_$language_code.txt + echo "Please edit ~/.gitconfig See: https://wiki.mageia.org/en/Git_usage_for_l10n_and_doc" > "$log_directory"/list_of_resources_for_translation_$language_code.txt echo -e "\E[31m" echo "It seems that you didn't configured git yet. A template configuration" | tee -a "$logfile"_this_run.log echo "file named ~/.gitconfig has been made in your home directory." | tee -a "$logfile"_this_run.log @@ -174,7 +174,8 @@ if [ ! -d "$working_translations_directory" ]; then fi echo "" | tee -a "$logfile"_this_run.log -date | tee -a "$logfile"_this_run.log +echo "script started at :" `date` | tee -a "$logfile"_this_run.log +echo "version of script :" `head -20 "${BASH_SOURCE[0]}" | grep check_for_translation_work.sh | cut -c38-61` | tee -a "$logfile"_this_run.log # Check if a newer version of this script is available. If yes, show the changes. if [ $check_updates -eq 1 ]; then @@ -207,6 +208,7 @@ declare -A translate_projects_help declare -A web_pages if [ -f "$git_directory"/translation_projects.dat ]; then source "$git_directory/translation_projects.dat" + echo "version of database:" `head -1 "$git_directory/translation_projects.dat"| cut -c53-76` | tee -a "$logfile"_this_run.log else echo -e "\E[31m" echo "Please set check_updates=1 in your configuration file first or copy" @@ -216,7 +218,7 @@ else exit 2 fi -echo "LIST OF RESOURCES WITH FUZZY OR EMPTY STRINGS (in $language_code language)" > "$log_directory"/list_of_resources_for_translation.txt +echo "LIST OF RESOURCES WITH FUZZY OR EMPTY STRINGS (in $language_code language)" > "$log_directory"/list_of_resources_for_translation_$language_code.txt # clone / pull git repositories echo -e "\E[32m" @@ -244,9 +246,9 @@ echo $separator | tee -a "$logfile"_this_run.log echo "" | tee -a "$logfile"_this_run.log echo -e "\E[32m" -echo "" >> "$log_directory"/list_of_resources_for_translation.txt +echo "" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt echo "Po and pot files:" | tee -a "$logfile"_this_run.log -echo "Translate po files in working (WD) or git directories:" >> "$log_directory"/list_of_resources_for_translation.txt +echo "Translate po files in working (WD) or git directories:" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt echo -e "\E[m" echo $separator | tee -a "$logfile"_this_run.log @@ -276,7 +278,7 @@ do if [ ! -d "$git_directory/${translate_projects_po[$translate_project_name_po]}/" ]; then echo "Directory $git_directory/${translate_projects_po[$translate_project_name_po]}/ doesn't exist." echo "It seems that something wen't wrong in git clone operation. Other operations in $translate_project_name_po will be aborted." - echo "All operations in $translate_project_name_po was aborted! Check script output or logs." >> "$log_directory"/list_of_resources_for_translation.txt + echo "All operations in $translate_project_name_po was aborted! Check script output or logs." >> "$log_directory"/list_of_resources_for_translation_$language_code.txt continue else cd "$git_directory/${translate_projects_po[$translate_project_name_po]}/" # $translate_project_name_po" @@ -356,12 +358,12 @@ do msgfmt -c "$git_directory/${translate_projects_po[$translate_project_name_po]}/$pot_filename" -o /dev/null if [ ${PIPESTATUS[0]} -ne 0 ]; then echo Test with msgfmt -c discovered a problem with "$git_directory/${translate_projects_po[$translate_project_name_po]}/$pot_filename" file. | tee -a "$logfile"_this_run.log - echo Please report on our mailing list that msgfmt -c test has a problem with "$translate_project_name_po/$pot_filename" file. >> "$log_directory"/list_of_resources_for_translation.txt + echo Please report on our mailing list that msgfmt -c test has a problem with "$translate_project_name_po/$pot_filename" file. >> "$log_directory"/list_of_resources_for_translation_$language_code.txt fi msgfmt -c "$git_directory/${translate_projects_po[$translate_project_name_po]}/"$language_code.po -o /dev/null if [ ${PIPESTATUS[0]} -ne 0 ]; then echo Test with msgfmt -c discovered a problem with "$git_directory/${translate_projects_po[$translate_project_name_po]}/"$language_code.po file. | tee -a "$logfile"_this_run.log - echo Test with msgfmt -c discovered a problem with $language_code.po file. Check script output or logs. >> "$log_directory"/list_of_resources_for_translation.txt + echo Test with msgfmt -c discovered a problem with $language_code.po file. Check script output or logs. >> "$log_directory"/list_of_resources_for_translation_$language_code.txt fi rm new_pot_$language_code.po # remove it as it's no good anyway fi @@ -438,10 +440,10 @@ do statistics=$statistics_git_pot fi if [ "$translate_this" = "yes" ]; then - echo " $i. $translate_project_name_po, $statistics" >> "$log_directory"/list_of_resources_for_translation.txt - echo " git: $git_directory/${translate_projects_po[$translate_project_name_po]}/$language_code.po" >> "$log_directory"/list_of_resources_for_translation.txt + echo " $i. $translate_project_name_po, $statistics" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt + echo " git: $git_directory/${translate_projects_po[$translate_project_name_po]}/$language_code.po" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt if [ $copying_po -eq 1 ]; then - echo " WD: $working_translations_directory/$translate_project_name_po/$language_code.po" >> "$log_directory"/list_of_resources_for_translation.txt + echo " WD: $working_translations_directory/$translate_project_name_po/$language_code.po" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt fi empty_list_of_po_file="no" let i++ @@ -451,14 +453,14 @@ do done echo $separator | tee -a "$logfile"_this_run.log if [ -z "$empty_list_of_po_file" ]; then - echo Congratulations. All po files are translated in $language_code language. >> "$log_directory"/list_of_resources_for_translation.txt + echo Congratulations. All po files are translated in $language_code language. >> "$log_directory"/list_of_resources_for_translation_$language_code.txt fi echo "" | tee -a "$logfile"_this_run.log echo -e "\E[32m" -echo "" >> "$log_directory"/list_of_resources_for_translation.txt +echo "" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt echo "*.desktop files:" | tee -a "$logfile"_this_run.log -echo "Translate *.desktop files in working (WD) or git directories:" >> "$log_directory"/list_of_resources_for_translation.txt +echo "Translate *.desktop files in working (WD) or git directories:" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt echo -e "\E[m" if [ -z "$work_on_desktop_files" ]; then empty_list_of_desktop_file="" @@ -468,7 +470,7 @@ if [ -z "$work_on_desktop_files" ]; then if [ ! -f "$git_directory/${translate_projects_desktop[$translate_project_name_desktop]}" ]; then echo "File $git_directory/${translate_projects_desktop[$translate_project_name_desktop]} doesn't exist." echo "It seems that something wen't wrong in git clone operation. Other operations in $translate_project_name_desktop will be aborted." - echo "All operations in $translate_project_name_desktop was aborted! Check script output or logs." >> "$log_directory"/list_of_resources_for_translation.txt + echo "All operations in $translate_project_name_desktop was aborted! Check script output or logs." >> "$log_directory"/list_of_resources_for_translation_$language_code.txt continue fi echo $separator | tee -a "$logfile"_this_run.log @@ -550,28 +552,28 @@ if [ -z "$work_on_desktop_files" ]; then fi fi if [ "$copy_this_desktop_file" = "yes" ]; then - echo " $i. $translate_project_name_desktop, untranslated line: $untranslated_name $untranslated_comment $untranslated_generic_name" >> "$log_directory"/list_of_resources_for_translation.txt - echo " git: $git_directory/${translate_projects_desktop[$translate_project_name_desktop]}" >> "$log_directory"/list_of_resources_for_translation.txt + echo " $i. $translate_project_name_desktop, untranslated line: $untranslated_name $untranslated_comment $untranslated_generic_name" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt + echo " git: $git_directory/${translate_projects_desktop[$translate_project_name_desktop]}" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt if [ -z $copying_desktop_files ]; then - echo " WD: $working_translations_directory/desktop/$translate_project_name_desktop/" >> "$log_directory"/list_of_resources_for_translation.txt + echo " WD: $working_translations_directory/desktop/$translate_project_name_desktop/" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt fi empty_list_of_desktop_file="no" let i++ fi done if [ -z "$empty_list_of_desktop_file" ]; then - echo Congratulations. All desktop files are translated in $language_code language. >> "$log_directory"/list_of_resources_for_translation.txt + echo Congratulations. All desktop files are translated in $language_code language. >> "$log_directory"/list_of_resources_for_translation_$language_code.txt fi else - echo Your configuration exclude work on desktop files >> "$log_directory"/list_of_resources_for_translation.txt + echo Your configuration exclude work on desktop files >> "$log_directory"/list_of_resources_for_translation_$language_code.txt fi echo $separator | tee -a "$logfile"_this_run.log echo "" | tee -a "$logfile"_this_run.log echo -e "\E[32m" -echo "" >> "$log_directory"/list_of_resources_for_translation.txt +echo "" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt echo "html software files:" | tee -a "$logfile"_this_run.log -echo "Copy and translate html software files in working (WD) or git directories:" >> "$log_directory"/list_of_resources_for_translation.txt +echo "Copy and translate html software files in working (WD) or git directories:" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt echo -e "\E[m" if [ -z "$work_on_html_software_files" ]; then empty_list_of_html_software_file="" @@ -583,15 +585,15 @@ if [ -z "$work_on_html_software_files" ]; then if [ ! -d "$git_directory/${translate_projects_help[$translate_project_name_help]}/" ]; then echo "File $git_directory/${translate_projects_help[$translate_project_name_help]} doesn't exist." echo "It seems that something wen't wrong in git clone operation. Other operations in $translate_project_name_help will be aborted." - echo "All operations in $translate_project_name_help was aborted! Check script output or logs." >> "$log_directory"/list_of_resources_for_translation.txt + echo "All operations in $translate_project_name_help was aborted! Check script output or logs." >> "$log_directory"/list_of_resources_for_translation_$language_code.txt continue fi if [ ! -d "$git_directory/${translate_projects_help[$translate_project_name_help]}/$language_code/" ]; then number_of_files=("$git_directory/${translate_projects_help[$translate_project_name_help]}/en/"*) - echo " $i. $translate_project_name_help, ${#number_of_files[@]} files" >> "$log_directory"/list_of_resources_for_translation.txt - echo " git: $git_directory/${translate_projects_po[$translate_project_name_help]}$translate_project_name_help/en/*.html" >> "$log_directory"/list_of_resources_for_translation.txt + echo " $i. $translate_project_name_help, ${#number_of_files[@]} files" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt + echo " git: $git_directory/${translate_projects_po[$translate_project_name_help]}$translate_project_name_help/en/*.html" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt if [ -z $copying_html_software_files ]; then - echo " WD: $working_translations_directory/$translate_project_name_help$translate_project_name_help/*.html" >> "$log_directory"/list_of_resources_for_translation.txt + echo " WD: $working_translations_directory/$translate_project_name_help$translate_project_name_help/*.html" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt if [ ! -d "$working_translations_directory/$translate_project_name_help/" ]; then mkdir -vp "$working_translations_directory/$translate_project_name_help/" | tee -a "$logfile"_this_run.log cp $copy_options "$git_directory/${translate_projects_help[$translate_project_name_help]}/en/" "$working_translations_directory/$translate_project_name_help/" | tee -a "$logfile"_this_run.log @@ -604,7 +606,7 @@ if [ -z "$work_on_html_software_files" ]; then done echo $separator | tee -a "$logfile"_this_run.log if [ -z "$empty_list_of_html_software_file" ]; then - echo Congratulations. All html directories in $language_code language exists. >> "$log_directory"/list_of_resources_for_translation.txt + echo Congratulations. All html directories in $language_code language exists. >> "$log_directory"/list_of_resources_for_translation_$language_code.txt fi fi @@ -612,8 +614,8 @@ if [ -z "$work_on_web_pages_translation" ]; then # Check out / update web_page files echo -e "\E[32m" echo "Check out / update web page files:" | tee -a "$logfile"_this_run.log - echo "" >> "$log_directory"/list_of_resources_for_translation.txt - echo "Please check http://www.mageia.org/langs/report.php for details about translation of web page files in $language_code language." >> "$log_directory"/list_of_resources_for_translation.txt + echo "" >> "$log_directory"/list_of_resources_for_translation_$language_code.txt + echo "Please check http://www.mageia.org/langs/report.php for details about translation of web page files in $language_code language." >> "$log_directory"/list_of_resources_for_translation_$language_code.txt echo -e "\E[m" for web_page_name in "${!web_pages[@]}" do @@ -715,7 +717,7 @@ fi echo $separator echo -e "\E[33m" # echo "List of resources for translation:" -cat "$log_directory"/list_of_resources_for_translation.txt +cat "$log_directory"/list_of_resources_for_translation_$language_code.txt echo -e "\E[m" # if you use this script by click it in GUI uncomment the next line -- cgit v1.2.1