diff options
author | filip <filip.komar@gmail.com> | 2013-12-03 22:36:01 +0100 |
---|---|---|
committer | filip <filip.komar@gmail.com> | 2013-12-03 22:36:01 +0100 |
commit | b750a3a98b7702f2994374a715ec70a4a5ee9958 (patch) | |
tree | 0dbd39685595285cb43ae3b2eb8e697619edf4e0 | |
parent | cc3684a8dda3424a1fddafdf60ef48040a461f52 (diff) | |
download | tools-b750a3a98b7702f2994374a715ec70a4a5ee9958.tar tools-b750a3a98b7702f2994374a715ec70a4a5ee9958.tar.gz tools-b750a3a98b7702f2994374a715ec70a4a5ee9958.tar.bz2 tools-b750a3a98b7702f2994374a715ec70a4a5ee9958.tar.xz tools-b750a3a98b7702f2994374a715ec70a4a5ee9958.zip |
added support for html software
added support for html software files NOTE: uncomment #copying_html_software_files=no line in your ~/.mageia-i18n-config file to exclude copying of html software resources
some fixes in desktop files part to really exclude them (work_on_desktop_files=no)
optionaly exclude working translations directory in list_of_resources_for_translation.txt
-rw-r--r-- | NEWS | 14 | ||||
-rwxr-xr-x | check_for_translation_work.sh | 231 | ||||
-rw-r--r-- | translation_projects.dat | 8 |
3 files changed, 158 insertions, 95 deletions
@@ -1,19 +1,32 @@ NEWS + +2013/12/03 +optionaly exclude working translations directory in list_of_resources_for_translation.txt +added support for html software files NOTE: uncomment #copying_html_software_files=no line in your ~/.mageia-i18n-config file to exclude copying of html software resources +some fixes in desktop files part to really exclude them (work_on_desktop_files=no) + 2013/11/30 beautifying a list_of_resources_for_translation.txt a bit + 2013/11/28 some cleaning in translation_projects.dat + 2013/11/09 small bugfix for and English only in list_of_resources_for_translation.txt + 2013/11/06 improvement in git grep + 2013/11/03 added warning about configuration excluding the work on desktop files in list_of_resources_for_translation.txt added test for GenericName for *.desktop file + 2013/11/02 added check and addition of git configuration thanks to Алексей Логинов + 2013/11/01 added option to exclude all work on web pages translation + 2013/10/31 added support for git NOTE: you need to add git_directory variable in your ~/.mageia-i18n-config file added creation of list_of_resources_for_translation.txt with statistics @@ -21,5 +34,6 @@ added support for *.desktop added support for doc team resources removed support for mga2 since it's EOL is almost here added creation of working copy of po resource + 2012/10/03 First script by Remco Rijnders diff --git a/check_for_translation_work.sh b/check_for_translation_work.sh index 8f3db431..b85c4ad8 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-11-30 21:31:00 UTC filip $ +# $Id: check_for_translation_work.sh 2013-12-03 21:15:00 UTC filip $ # # Please see git for a list of changes to this script. # @@ -58,6 +58,9 @@ copying_po=1 # uncomment next line to exclude work on html software resources #work_on_html_software_files=no +# uncomment next line to exclude copying of html software resources +#copying_html_software_files=no + # uncomment next line to exclude all work on web pages translation #work_on_web_pages_translation=no @@ -245,6 +248,7 @@ echo "" >> "$log_directory"/list_of_resources_for_translation.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 -e "\E[m" +echo $separator | tee -a "$logfile"_this_run.log # echo about checking the syntax of po file if required if [ $check_po_syntax -eq 1 ]; then @@ -256,6 +260,7 @@ if [ $copying_po -eq 1 ]; then echo "Files *.pot and $language_code.po will be copied into apropriate directory." fi +empty_list_of_po_file="" i=1 for translate_project_name_po in "${!translate_projects_po[@]}" do @@ -438,12 +443,16 @@ do 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 fi - empty_list_of_desktop_file="no" + empty_list_of_po_file="no" let i++ fi # cd "$git_directory/" # echo "" | tee -a "$logfile"_this_run.log 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 +fi echo "" | tee -a "$logfile"_this_run.log echo -e "\E[32m" @@ -451,110 +460,152 @@ echo "" >> "$log_directory"/list_of_resources_for_translation.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 -e "\E[m" -empty_list_of_desktop_file="" -i=1 -for translate_project_name_desktop in "${!translate_projects_desktop[@]}" -do - 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 - continue - fi - echo $separator | tee -a "$logfile"_this_run.log - copy_this_desktop_file="no" - untranslated_name="Name, " - untranslated_comment="Comment," - untranslated_generic_name="GenericName, " - names_and_comments="" - echo "Working on *.desktop file in working translations directory: $translate_project_name_desktop and local git directory: ${translate_projects_desktop[$translate_project_name_desktop]}." | tee -a "$logfile"_this_run.log -# cd "$git_directory/${translate_projects_desktop[$translate_project_name_desktop]}/" # $translate_project_name_desktop" - names_and_comments=`cat "$git_directory/${translate_projects_desktop[$translate_project_name_desktop]}" #| grep -E "^Name=|^Name\[$language_code\]=|^Comment=|^Comment\[$language_code\]="` -# echo names_and_comments: "$names_and_comments" # debug - eng_name=`echo "$names_and_comments" | grep -E "^Name=" | sed 's/^Name=//'` - lang_name=`echo "$names_and_comments" | grep -E "^Name\[$language_code\]=" | sed 's/^Name\['$language_code'\]=//'` - eng_comment=`echo "$names_and_comments" | grep -E "^Comment=" | sed 's/^Comment=//'` - lang_comment=`echo "$names_and_comments" | grep -E "^Comment\[$language_code\]=" | sed 's/^Comment\['$language_code'\]=//'` - eng_generic_name=`echo "$names_and_comments" | grep -E "^GenericName=" | sed 's/^GenericName=//'` - lang_generic_name=`echo "$names_and_comments" | grep -E "^GenericName\[$language_code\]=" | sed 's/^GenericName\['$language_code'\]=//'` - - if [ -n "$eng_name" ]; then # Name string present in original desktop file - if [ -n "$lang_name" ]; then # Name string present in your language - if [ "$lang_name" != "$eng_name" ]; then # both strings differ -# echo Name string \"$eng_name\" present in $language_code language: \"$lang_name\" # debug -# echo -n # nop - untranslated_name="" - else # both strings are equal +if [ -z "$work_on_desktop_files" ]; then + empty_list_of_desktop_file="" + i=1 + for translate_project_name_desktop in "${!translate_projects_desktop[@]}" + do + 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 + continue + fi + echo $separator | tee -a "$logfile"_this_run.log + copy_this_desktop_file="no" + untranslated_name="Name, " + untranslated_comment="Comment," + untranslated_generic_name="GenericName, " + names_and_comments="" + echo "Working on *.desktop file in working translations directory: $translate_project_name_desktop and local git directory: ${translate_projects_desktop[$translate_project_name_desktop]}." | tee -a "$logfile"_this_run.log +# cd "$git_directory/${translate_projects_desktop[$translate_project_name_desktop]}/" # $translate_project_name_desktop" + names_and_comments=`cat "$git_directory/${translate_projects_desktop[$translate_project_name_desktop]}" #| grep -E "^Name=|^Name\[$language_code\]=|^Comment=|^Comment\[$language_code\]="` +# echo names_and_comments: "$names_and_comments" # debug + eng_name=`echo "$names_and_comments" | grep -E "^Name=" | sed 's/^Name=//'` + lang_name=`echo "$names_and_comments" | grep -E "^Name\[$language_code\]=" | sed 's/^Name\['$language_code'\]=//'` + eng_comment=`echo "$names_and_comments" | grep -E "^Comment=" | sed 's/^Comment=//'` + lang_comment=`echo "$names_and_comments" | grep -E "^Comment\[$language_code\]=" | sed 's/^Comment\['$language_code'\]=//'` + eng_generic_name=`echo "$names_and_comments" | grep -E "^GenericName=" | sed 's/^GenericName=//'` + lang_generic_name=`echo "$names_and_comments" | grep -E "^GenericName\[$language_code\]=" | sed 's/^GenericName\['$language_code'\]=//'` + + if [ -n "$eng_name" ]; then # Name string present in original desktop file + if [ -n "$lang_name" ]; then # Name string present in your language + if [ "$lang_name" != "$eng_name" ]; then # both strings differ +# echo Name string \"$eng_name\" present in $language_code language: \"$lang_name\" # debug +# echo -n # nop + untranslated_name="" + else # both strings are equal + copy_this_desktop_file="yes" + echo Name string \"$eng_name\" in $language_code language present but untranslated | tee -a "$logfile"_this_run.log + fi + else # Name string not present in your language copy_this_desktop_file="yes" - echo Name string \"$eng_name\" in $language_code language present but untranslated | tee -a "$logfile"_this_run.log + echo Name string \"$eng_name\" not present in $language_code language | tee -a "$logfile"_this_run.log fi - else # Name string not present in your language - copy_this_desktop_file="yes" - echo Name string \"$eng_name\" not present in $language_code language | tee -a "$logfile"_this_run.log + else + untranslated_name="" fi - else - untranslated_name="" - fi - if [ -n "$eng_comment" ]; then # Comment string present in original desktop file - if [ -n "$lang_comment" ]; then # Comment string present in your language - if [ "$lang_comment" != "$eng_comment" ]; then # both strings differ -# echo Comment string \"$eng_comment\" in $language_code language present: \"$lang_comment\" # debug -# echo -n # nop - untranslated_comment="" - else # both strings are equal + if [ -n "$eng_comment" ]; then # Comment string present in original desktop file + if [ -n "$lang_comment" ]; then # Comment string present in your language + if [ "$lang_comment" != "$eng_comment" ]; then # both strings differ +# echo Comment string \"$eng_comment\" in $language_code language present: \"$lang_comment\" # debug +# echo -n # nop + untranslated_comment="" + else # both strings are equal + copy_this_desktop_file="yes" + echo Comment string \"$eng_comment\" in $language_code language present but untranslated | tee -a "$logfile"_this_run.log + fi + else # Comment string not present in your language copy_this_desktop_file="yes" - echo Comment string \"$eng_comment\" in $language_code language present but untranslated | tee -a "$logfile"_this_run.log + echo Comment string \"$eng_comment\" not present in $language_code language | tee -a "$logfile"_this_run.log fi - else # Comment string not present in your language - copy_this_desktop_file="yes" - echo Comment string \"$eng_comment\" not present in $language_code language | tee -a "$logfile"_this_run.log + else + untranslated_comment="" fi - else - untranslated_comment="" - fi - if [ -n "$eng_generic_name" ]; then # GenericName string present in original desktop file - if [ -n "$lang_generic_name" ]; then # GenericName string present in your language - if [ "$lang_generic_name" != "$eng_generic_name" ]; then # both strings differ -# echo GenericName string \"$eng_generic_name\" in $language_code language present: \"$lang_generic_name\" # debug -# echo -n # nop - untranslated_generic_name="" - else # both strings are equal + if [ -n "$eng_generic_name" ]; then # GenericName string present in original desktop file + if [ -n "$lang_generic_name" ]; then # GenericName string present in your language + if [ "$lang_generic_name" != "$eng_generic_name" ]; then # both strings differ +# echo GenericName string \"$eng_generic_name\" in $language_code language present: \"$lang_generic_name\" # debug +# echo -n # nop + untranslated_generic_name="" + else # both strings are equal + copy_this_desktop_file="yes" + echo GenericName string \"$eng_generic_name\" in $language_code language present but untranslated | tee -a "$logfile"_this_run.log + fi + else # GenericName string not present in your language copy_this_desktop_file="yes" - echo GenericName string \"$eng_generic_name\" in $language_code language present but untranslated | tee -a "$logfile"_this_run.log + echo GenericName string \"$eng_generic_name\" not present in $language_code language | tee -a "$logfile"_this_run.log fi - else # GenericName string not present in your language - copy_this_desktop_file="yes" - echo GenericName string \"$eng_generic_name\" not present in $language_code language | tee -a "$logfile"_this_run.log + else + untranslated_generic_name="" fi - else - untranslated_generic_name="" - fi -# copying the *.desktop file for editing in working directory if required - if [ -z $copying_desktop_files ]; then - if [ "$copy_this_desktop_file" = "yes" ]; then - if [ ! -d "$working_translations_directory/desktop/$translate_project_name_desktop/" ]; then - mkdir -vp "$working_translations_directory/desktop/$translate_project_name_desktop/" | tee -a "$logfile"_this_run.log +# copying the *.desktop file for editing in working directory if required + if [ -z $copying_desktop_files ]; then + if [ "$copy_this_desktop_file" = "yes" ]; then + if [ ! -d "$working_translations_directory/desktop/$translate_project_name_desktop/" ]; then + mkdir -vp "$working_translations_directory/desktop/$translate_project_name_desktop/" | tee -a "$logfile"_this_run.log + fi + cp $copy_options "$git_directory/${translate_projects_desktop[$translate_project_name_desktop]}" "$working_translations_directory/desktop/$translate_project_name_desktop/" | tee -a "$logfile"_this_run.log fi - cp $copy_options "$git_directory/${translate_projects_desktop[$translate_project_name_desktop]}" "$working_translations_directory/desktop/$translate_project_name_desktop/" | tee -a "$logfile"_this_run.log 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 - if [ -z $copying_desktop_files ]; then - echo " WD: $working_translations_directory/desktop/$translate_project_name_desktop/" >> "$log_directory"/list_of_resources_for_translation.txt + 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 + if [ -z $copying_desktop_files ]; then + echo " WD: $working_translations_directory/desktop/$translate_project_name_desktop/" >> "$log_directory"/list_of_resources_for_translation.txt + fi + empty_list_of_desktop_file="no" + let i++ fi - empty_list_of_desktop_file="no" - let i++ - fi -done -if [ -n "$work_on_desktop_files" ]; then - echo Your configuration exclude work on desktop files >> "$log_directory"/list_of_resources_for_translation.txt -else + 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 fi +else + echo Your configuration exclude work on desktop files >> "$log_directory"/list_of_resources_for_translation.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 "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 -e "\E[m" +if [ -z "$work_on_html_software_files" ]; then + empty_list_of_html_software_file="" + i=1 + for translate_project_name_help in "${!translate_projects_help[@]}" + do + echo $separator | tee -a "$logfile"_this_run.log + echo "Working on html software files for $language_code language code in working translations directory: $translate_project_name_help and local git directory: ${translate_projects_help[$translate_project_name_help]}." | tee -a "$logfile"_this_run.log + 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 + 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 + 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 + 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 + fi + fi + echo "Please copy directory ./en/ from $translate_project_name_help/ to ./$language_code/ there. After translation of all those ${#number_of_files[@]} html files copy ./$language_code/ directory to local git directory: ${translate_projects_help[$translate_project_name_help]}/$language_code/." + empty_list_of_html_software_file="no" + let i++ + fi + 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 + fi fi if [ -z "$work_on_web_pages_translation" ]; then diff --git a/translation_projects.dat b/translation_projects.dat index 7e431225..9aa454fd 100644 --- a/translation_projects.dat +++ b/translation_projects.dat @@ -1,4 +1,4 @@ -# database for script check_for_translation_work.sh 2013-11-28 21:31:00 UTC filip +# database for script check_for_translation_work.sh 2013-12-01 20:46:00 UTC filip # GIT ADDRESSES # Repositories of resources for Cauldron and the next released version of Mageia @@ -158,11 +158,9 @@ if [ -z "$work_on_desktop_files" ]; then # no translations?? mgaonline/trunk/x-mga-exec.desktop fi - -# HTML FILES # TODO add them also in script if [ -z "$work_on_html_software_files" ]; then - translate_projects_help[mageia-gfxboot-theme_help-boot]="bootloader-theme/help-boot" - translate_projects_help[mageia-gfxboot-theme_help-install]="bootloader-theme/help-install" + translate_projects_help[mageia-gfxboot-theme_help-boot]="mageia-gfxboot-theme/help-boot" + translate_projects_help[mageia-gfxboot-theme_help-install]="mageia-gfxboot-theme/help-install" # cat svn_list | grep trunk | egrep html$ | fgrep .html # no translations Mandrake!! control-center/trunk/doc/DrakConf.html # it seems unused # no translations desktop-common-data/trunk/bookmarks/mozilla/mozilla-download.html # needs some i18n work but doesn't seems needed |