GunChleoc has proposed merging lp:~gunchleoc/widelands/translation_validation_folder_structure into lp:widelands.
Commit message: Copy translation validation results into maintainers' and translators' views to make them easier for translators to navigate. Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~gunchleoc/widelands/translation_validation_folder_structure/+merge/355599 -- Your team Widelands Developers is requested to review the proposed merge of lp:~gunchleoc/widelands/translation_validation_folder_structure into lp:widelands.
=== modified file 'utils/glossary_checks.py' --- utils/glossary_checks.py 2017-08-17 14:06:54 +0000 +++ utils/glossary_checks.py 2018-09-26 05:55:25 +0000 @@ -512,8 +512,8 @@ hit.term, hit.translation, hit.source, hit.target, hit.po_file, hit.location) locale_result = locale_result + row counter = counter + 1 - dest_filepath = output_path + '/glossary_check_' + locale + '.csv' - with open(dest_filepath, 'wt') as dest_file: + dest_filepath = make_path(output_path, locale) + with open(dest_filepath + '/glossary_check.csv', 'wt') as dest_file: dest_file.write(locale_result) # Uncomment this line to print a statistic of the number of hits for each locale # print("%s\t%d"%(locale, counter)) @@ -547,7 +547,7 @@ input_path = os.path.abspath(os.path.join( os.path.dirname(__file__), '../po')) - output_path = make_path(os.path.dirname(__file__), '../po_validation') + output_path = make_path(os.path.dirname(__file__), '../po_validation/translators') result = check_translations_with_glossary( input_path, output_path, glossary_file, locale) print('Current time: %s' % time.ctime()) === modified file 'utils/validate_translations.sh' --- utils/validate_translations.sh 2018-09-10 07:00:08 +0000 +++ utils/validate_translations.sh 2018-09-26 05:55:25 +0000 @@ -18,36 +18,46 @@ exit 1; fi -# Make sure that the output directory is there +# Make sure that the output directories are there and empty +echo "Creating directories in 'po_validation'" if [ ! -d "po_validation" ]; then - echo "Creating directory 'po_validation'" mkdir po_validation fi +if [ ! -d "po_validation/maintainers" ]; then + mkdir po_validation/maintainers +else + rm -rf po_validation/maintainers/* +fi +if [ ! -d "po_validation/translators" ]; then + mkdir po_validation/translators +else + rm -rf po_validation/translators/* +fi echo "Running i18nspector. This can take a while." # We want a log of all errors. i18nspector po/*/*.po \ | grep "E:" \ - > po_validation/i18nspector-errors.log + > po_validation/maintainers/i18nspector-errors.log # We don't care about all warnings, so we filter some out. i18nspector po/*/*.po \ | grep "W:" \ | grep -v "invalid-last-translator" \ | grep -v boilerplate \ - > po_validation/i18nspector-warnings.log + > po_validation/maintainers/i18nspector-warnings.log # Takes type of check as an argument. # Makes a subdirectory for the argument if necessary, # then runs pofilter with the check. function run_pofilter() { - if [ ! -d "po_validation/$1/" ]; then - mkdir po_validation/$1/ + if [ ! -d "po_validation/maintainers/$1/" ]; then + mkdir po_validation/maintainers/$1/ fi echo "Running pofilter for '$1'" - pofilter -t $1 -i po/ -o po_validation/$1/ + pofilter -t $1 -i po/ -o po_validation/maintainers/$1/ } # These checks are critical @@ -72,30 +82,44 @@ run_pofilter "numbers" # We only run the options check on the command line help -if [ ! -d "po_validation/options/" ]; then +if [ ! -d "po_validation/maintainers/options/" ]; then echo "Creating directory 'options'" - mkdir po_validation/options/ + mkdir po_validation/maintainers/options/ fi echo "Running pofilter for 'options'" -pofilter -t options -i po/widelands_console/ -o po_validation/options/ +pofilter -t options -i po/widelands_console/ -o po_validation/maintainers/options/ -echo "Cleaning up empty directories" -for dir in po_validation/*/ +echo "Processing directories" +for dir in po_validation/maintainers/*/ do dir=${dir%*/} - echo "- Cleaning up ${dir##*/}" - if [ ! "$(find po_validation/${dir##*/}/ -mindepth 1 -maxdepth 1 -type d -printf . | wc -c)" -eq 0 ]; then - for subdir in po_validation/${dir##*/}/*/ + echo "- ${dir##*/}" + if [ ! "$(find po_validation/maintainers/${dir##*/}/ -mindepth 1 -maxdepth 1 -type d -printf . | wc -c)" -eq 0 ]; then + for subdir in po_validation/maintainers/${dir##*/}/*/ do subdir=${subdir%*/} - if [ ! "$(ls -A po_validation/${dir##*/}/${subdir##*/})" ]; then - rmdir po_validation/${dir##*/}/${subdir##*/} + if [ ! "$(ls -A po_validation/maintainers/${dir##*/}/${subdir##*/})" ]; then + # Delete empty directories + rmdir po_validation/maintainers/${dir##*/}/${subdir##*/} + else + # Copy files to translators' view + category=$(basename "$dir") + textdomain=$(basename "$subdir") + for localepath in $(find $subdir -maxdepth 2 -type f) + do + locale=$(basename "${localepath%.*}") + targetpath="po_validation/translators/$locale/$textdomain/$category.po" + if [ ! -d "po_validation/translators/$locale/" ]; then + mkdir po_validation/translators/$locale/ + fi + if [ ! -d "po_validation/translators/$locale/$textdomain/" ]; then + mkdir po_validation/translators/$locale/$textdomain/ + fi + cp $localepath $targetpath + done fi done fi - if [ ! "$(ls -A po_validation/${dir##*/})" ]; then - rmdir po_validation/${dir##*/} - fi done echo "Done"
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp