From a9f0ff441d3dd647134f9d8999efcd7d02197016 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Fri, 23 Apr 2021 12:15:48 +0200 Subject: [PATCH 1/5] Allow to customize OUTDIR in config.sh Useful for custom build trees. --- lang/config.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lang/config.sh b/lang/config.sh index f518693fc..954424c2b 100755 --- a/lang/config.sh +++ b/lang/config.sh @@ -17,7 +17,9 @@ export OBJCOPY=$ARDUINO/hardware/tools/avr/bin/avr-objcopy export OBJDUMP=$ARDUINO/hardware/tools/avr/bin/avr-objdump # # Output folder: -export OUTDIR="../../Prusa-Firmware-build" +if [ -z "$OUTDIR" ]; then + export OUTDIR="../../Prusa-Firmware-build" +fi # # Objects folder: export OBJDIR="$OUTDIR/sketch" From 8b5d01e3b1a697b272995abf49e20c873a4b42ac Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Fri, 23 Apr 2021 12:18:50 +0200 Subject: [PATCH 2/5] Be more strict when checking translation lenght Strip quotes immediately so that we can measure strings easily. For single-line strings, check the translation lenght correctly. --- lang/lang-check.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lang/lang-check.py b/lang/lang-check.py index 1e6ff5195..3ddbdc67d 100755 --- a/lang/lang-check.py +++ b/lang/lang-check.py @@ -36,20 +36,20 @@ def parse_txt(lang, no_warning): while True: comment = src.readline().split(' ') #print (comment) #Debug - source = src.readline()[:-1] + source = src.readline()[:-1].strip('"') #print (source) #Debug - translation = src.readline()[:-1] + translation = src.readline()[:-1].strip('"') #print (translation) #Debug #Wrap text to 20 chars and rows wrapper = textwrap.TextWrapper(width=20) #wrap original/source rows_count_source = 0 - for line in wrapper.wrap(source.strip('"')): + for line in wrapper.wrap(source): rows_count_source += 1 #print (line) #Debug #wrap translation rows_count_translation = 0 - for line in wrapper.wrap(translation.strip('"')): + for line in wrapper.wrap(translation): rows_count_translation += 1 #print (line) #Debug #End wrap text @@ -76,9 +76,11 @@ def parse_txt(lang, no_warning): if rows is None: rows = 1 - if rows_count_translation > rows_count_source and rows_count_translation > rows: - print(red("[E]: Text %s is longer then definition on line %d rows diff=%d\n[EN]:Text %s cols=%d rows=%d\n" % (translation, lines, rows_count_translation-rows, source, cols, rows))) - + if (rows_count_translation > rows_count_source and rows_count_translation > rows) or \ + (rows == 1 and len(translation) > cols): + print(red('[E]: Text "%s" is longer then definition on line %d (rows diff=%d)\n' + '[EN]:Text "%s" cols=%d rows=%d\n' % (translation, lines, rows_count_translation-rows, source, cols, rows))) + if len(src.readline()) != 1: # empty line break From 2e6e2c4fde2e4fec0ecf17f19f7549315b2b4016 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Fri, 23 Apr 2021 12:26:15 +0200 Subject: [PATCH 3/5] Do not output colors when redirecting output --- lang/lang-check.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lang/lang-check.py b/lang/lang-check.py index 3ddbdc67d..c5bfbe9ab 100755 --- a/lang/lang-check.py +++ b/lang/lang-check.py @@ -15,12 +15,18 @@ """Check lang files.""" from argparse import ArgumentParser from traceback import print_exc -from sys import stderr +from sys import stdout, stderr import textwrap -red = lambda text: '\033[0;31m' + text + '\033[0m' -green = lambda text: '\033[0;32m' + text + '\033[0m' -yellow = lambda text: '\033[0;33m' + text + '\033[0m' +def color_maybe(color_attr, text): + if stdout.isatty(): + return '\033[0;' + str(color_attr) + 'm' + text + '\033[0m' + else: + return text + +red = lambda text: color_maybe(31, text) +green = lambda text: color_maybe(32, text) +yellow = lambda text: color_maybe(33, text) def parse_txt(lang, no_warning): """Parse txt file and check strings to display definition.""" From 90a9e350c021e2bf59d0065fea0acbff3129d64e Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Fri, 23 Apr 2021 12:37:54 +0200 Subject: [PATCH 4/5] Remove warnings caused by '\x00' Manually unescape '\x00' for the time being, removing spurious warnings. --- lang/lang-check.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lang/lang-check.py b/lang/lang-check.py index c5bfbe9ab..62ba02524 100755 --- a/lang/lang-check.py +++ b/lang/lang-check.py @@ -45,6 +45,9 @@ def parse_txt(lang, no_warning): source = src.readline()[:-1].strip('"') #print (source) #Debug translation = src.readline()[:-1].strip('"') + if translation == '\\x00': + # crude hack to handle intentionally-empty translations + translation = '' #print (translation) #Debug #Wrap text to 20 chars and rows wrapper = textwrap.TextWrapper(width=20) From 346044063a9170f457b755d6fa61de3867a9c909 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Fri, 23 Apr 2021 12:48:25 +0200 Subject: [PATCH 5/5] Fix length of some CZ messages --- lang/lang_en_cz.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index a57ef4ba5..c1140a74c 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -140,7 +140,7 @@ #MSG_CALIBRATING_HOME c=20 "Calibrating home" -"Kalibruji vychozi poz." +"Kalibruji vychozi p." #MSG_CALIBRATE_BED c=18 "Calibrate XYZ" @@ -604,7 +604,7 @@ #MSG_MEASURED_SKEW c=13 "Measured skew" -"Merene zkoseni" +"Merene zkos." #MSG_MMU_FAILS c=15 "MMU fails" @@ -616,7 +616,7 @@ #MSG_MMU_LOAD_FAILS c=15 "MMU load fails" -"MMU selhani zavadeni" +"MMU selhani zav" #MSG_MMU_OK_RESUMING c=20 r=4 "MMU OK. Resuming..." @@ -644,7 +644,7 @@ #MSG_MMU_POWER_FAILS c=15 "MMU power fails" -"MMU vypadky proudu" +"MMU vyp. proudu" #MSG_STEALTH c=7 "Stealth" @@ -652,7 +652,7 @@ #MSG_AUTO_POWER c=10 "Auto power" -"Automaticky" +"Automat." #MSG_HIGH_POWER c=10 "High power" @@ -732,7 +732,7 @@ #MSG_NOZZLE_FAN c=10 "Nozzle FAN" -"Vent. trysky" +"V. trysky" #MSG_PAUSE_PRINT c=18 "Pause print" @@ -868,7 +868,7 @@ #MSG_PRESS_KNOB c=20 "Press the knob" -"Stisknete hl. tlacitko" +"Stisknete tlacitko" #MSG_PRINT_PAUSED c=20 "Print paused" @@ -884,7 +884,7 @@ #MSG_PRINT_FAN c=10 "Print FAN" -"Tiskovy vent." +"Tiskovy v." #MSG_WIZARD_LOAD_FILAMENT c=20 r=6 "Please insert filament into the extruder, then press the knob to load it." @@ -1044,7 +1044,7 @@ #MSG_SEVERE_SKEW c=13 "Severe skew:" -"Tezke zkoseni:" +"Tezke zkos.:" #MSG_SORT_ALPHA c=8 "Alphabet" @@ -1060,7 +1060,7 @@ #MSG_SLIGHT_SKEW c=13 "Slight skew:" -"Lehke zkoseni:" +"Lehke zkos.:" #MSG_SOUND c=7 "Sound"