Merge lp:~gunchleoc/widelands/translation_validation_folder_structure into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8856
Proposed branch: lp:~gunchleoc/widelands/translation_validation_folder_structure
Merge into: lp:widelands
Diff against target: 139 lines (+47/-23)
2 files modified
utils/glossary_checks.py (+3/-3)
utils/validate_translations.sh (+44/-20)
To merge this branch: bzr merge lp:~gunchleoc/widelands/translation_validation_folder_structure
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+355599@code.launchpad.net

Commit message

Copy translation validation results into maintainers' and translators' views to make them easier for translators to navigate.

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

This doesn't affect Widelands itself, so it can go straight in

@bunnybot merge

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4046. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/433324366.
Appveyor build 3842. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_gunchleoc_widelands_translation_validation_folder_structure-3842.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
512 hit.term, hit.translation, hit.source, hit.target, hit.po_file, hit.location)512 hit.term, hit.translation, hit.source, hit.target, hit.po_file, hit.location)
513 locale_result = locale_result + row513 locale_result = locale_result + row
514 counter = counter + 1514 counter = counter + 1
515 dest_filepath = output_path + '/glossary_check_' + locale + '.csv'515 dest_filepath = make_path(output_path, locale)
516 with open(dest_filepath, 'wt') as dest_file:516 with open(dest_filepath + '/glossary_check.csv', 'wt') as dest_file:
517 dest_file.write(locale_result)517 dest_file.write(locale_result)
518 # Uncomment this line to print a statistic of the number of hits for each locale518 # Uncomment this line to print a statistic of the number of hits for each locale
519 # print("%s\t%d"%(locale, counter))519 # print("%s\t%d"%(locale, counter))
@@ -547,7 +547,7 @@
547547
548 input_path = os.path.abspath(os.path.join(548 input_path = os.path.abspath(os.path.join(
549 os.path.dirname(__file__), '../po'))549 os.path.dirname(__file__), '../po'))
550 output_path = make_path(os.path.dirname(__file__), '../po_validation')550 output_path = make_path(os.path.dirname(__file__), '../po_validation/translators')
551 result = check_translations_with_glossary(551 result = check_translations_with_glossary(
552 input_path, output_path, glossary_file, locale)552 input_path, output_path, glossary_file, locale)
553 print('Current time: %s' % time.ctime())553 print('Current time: %s' % time.ctime())
554554
=== 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 @@
18 exit 1;18 exit 1;
19fi19fi
2020
21# Make sure that the output directory is there21# Make sure that the output directories are there and empty
22echo "Creating directories in 'po_validation'"
22if [ ! -d "po_validation" ]; then23if [ ! -d "po_validation" ]; then
23 echo "Creating directory 'po_validation'"
24 mkdir po_validation24 mkdir po_validation
25fi25fi
26if [ ! -d "po_validation/maintainers" ]; then
27 mkdir po_validation/maintainers
28else
29 rm -rf po_validation/maintainers/*
30fi
31if [ ! -d "po_validation/translators" ]; then
32 mkdir po_validation/translators
33else
34 rm -rf po_validation/translators/*
35fi
2636
27echo "Running i18nspector. This can take a while."37echo "Running i18nspector. This can take a while."
2838
29# We want a log of all errors.39# We want a log of all errors.
30i18nspector po/*/*.po \40i18nspector po/*/*.po \
31 | grep "E:" \41 | grep "E:" \
32 > po_validation/i18nspector-errors.log42 > po_validation/maintainers/i18nspector-errors.log
3343
34# We don't care about all warnings, so we filter some out.44# We don't care about all warnings, so we filter some out.
35i18nspector po/*/*.po \45i18nspector po/*/*.po \
36 | grep "W:" \46 | grep "W:" \
37 | grep -v "invalid-last-translator" \47 | grep -v "invalid-last-translator" \
38 | grep -v boilerplate \48 | grep -v boilerplate \
39 > po_validation/i18nspector-warnings.log49 > po_validation/maintainers/i18nspector-warnings.log
4050
4151
42# Takes type of check as an argument.52# Takes type of check as an argument.
43# Makes a subdirectory for the argument if necessary,53# Makes a subdirectory for the argument if necessary,
44# then runs pofilter with the check.54# then runs pofilter with the check.
45function run_pofilter() {55function run_pofilter() {
46 if [ ! -d "po_validation/$1/" ]; then56 if [ ! -d "po_validation/maintainers/$1/" ]; then
47 mkdir po_validation/$1/57 mkdir po_validation/maintainers/$1/
48 fi58 fi
49 echo "Running pofilter for '$1'"59 echo "Running pofilter for '$1'"
50 pofilter -t $1 -i po/ -o po_validation/$1/60 pofilter -t $1 -i po/ -o po_validation/maintainers/$1/
51}61}
5262
53# These checks are critical63# These checks are critical
@@ -72,30 +82,44 @@
72run_pofilter "numbers"82run_pofilter "numbers"
7383
74# We only run the options check on the command line help84# We only run the options check on the command line help
75if [ ! -d "po_validation/options/" ]; then85if [ ! -d "po_validation/maintainers/options/" ]; then
76 echo "Creating directory 'options'"86 echo "Creating directory 'options'"
77 mkdir po_validation/options/87 mkdir po_validation/maintainers/options/
78fi88fi
79echo "Running pofilter for 'options'"89echo "Running pofilter for 'options'"
80pofilter -t options -i po/widelands_console/ -o po_validation/options/90pofilter -t options -i po/widelands_console/ -o po_validation/maintainers/options/
8191
82echo "Cleaning up empty directories"92echo "Processing directories"
83for dir in po_validation/*/93for dir in po_validation/maintainers/*/
84do94do
85 dir=${dir%*/}95 dir=${dir%*/}
86 echo "- Cleaning up ${dir##*/}"96 echo "- ${dir##*/}"
87 if [ ! "$(find po_validation/${dir##*/}/ -mindepth 1 -maxdepth 1 -type d -printf . | wc -c)" -eq 0 ]; then97 if [ ! "$(find po_validation/maintainers/${dir##*/}/ -mindepth 1 -maxdepth 1 -type d -printf . | wc -c)" -eq 0 ]; then
88 for subdir in po_validation/${dir##*/}/*/98 for subdir in po_validation/maintainers/${dir##*/}/*/
89 do99 do
90 subdir=${subdir%*/}100 subdir=${subdir%*/}
91 if [ ! "$(ls -A po_validation/${dir##*/}/${subdir##*/})" ]; then101 if [ ! "$(ls -A po_validation/maintainers/${dir##*/}/${subdir##*/})" ]; then
92 rmdir po_validation/${dir##*/}/${subdir##*/}102 # Delete empty directories
103 rmdir po_validation/maintainers/${dir##*/}/${subdir##*/}
104 else
105 # Copy files to translators' view
106 category=$(basename "$dir")
107 textdomain=$(basename "$subdir")
108 for localepath in $(find $subdir -maxdepth 2 -type f)
109 do
110 locale=$(basename "${localepath%.*}")
111 targetpath="po_validation/translators/$locale/$textdomain/$category.po"
112 if [ ! -d "po_validation/translators/$locale/" ]; then
113 mkdir po_validation/translators/$locale/
114 fi
115 if [ ! -d "po_validation/translators/$locale/$textdomain/" ]; then
116 mkdir po_validation/translators/$locale/$textdomain/
117 fi
118 cp $localepath $targetpath
119 done
93 fi120 fi
94 done121 done
95 fi122 fi
96 if [ ! "$(ls -A po_validation/${dir##*/})" ]; then
97 rmdir po_validation/${dir##*/}
98 fi
99done123done
100124
101echo "Done"125echo "Done"

Subscribers

People subscribed via source and target branches

to status/vote changes: