Prusa-Firmware/Firmware
Yuri D'Elia 0d7680dbf7
New PO-based language translation support (#3471)
* lang: Add a PO language extractor with FW metadata support

Implement a straight-to-po language extractor which supports our custom
language requirements:

- _i/_I/ISTR for text string definitions
- _T for catalog translations (with back-reference support)
- //// EOL comments with:
  - MSG_ catalog entry name identifiers
  - c=X r=Y annotations for screen dimensioning checks
- Crude support for commented lines

All source locations are correctly referenced in the PO, with the
metadata colleted in the comment for further processing.

Several checks are implemented already during extraction:

- Correct catalog name assignment (no duplicates)
- Metadata checks for each entry

Further checks will be implemented by directly checking the translated PO file.

Requires "polib" and "regex" python modules.

* lang: Adapt lang-check to work directly on PO/POT files

* lang: Allow lang-extract to generate stable (pre-sorted) output directly

* lang: Further extend lang-extract consistency/error checking

- Do not parse inside preprocessor conditionals
- Distinguish between references and definitions
- Warn about missing references and definitions

* lang: lang-extract: warn about incorrect PROGMEM assignments

Check that ISTR is used along with PROGMEM_I1 in an attempt to spot
useless translated catalogs.

* lang: lang-extract: Improved handling of same-line translations

Correctly reference metadata on same-line translations.

* lang: lang-extract: Handle _O as a cat-ref

https://github.com/prusa3d/Prusa-Firmware/pull/3434

* lang: lang-extract: Warn about unused catalog definitions

* lang: lang-extract: Allow propagating translation comments via //

The definition:

    code //// definition [// comment]

will check [definition] as before, but blindly accumulate // comment.
The comment is then re-appended back into the PO files for translators
with the form:

    definition
    comment
    comment...

* lang: Fix incorrect display definitions

* lang: lang-extract: Check source encoding/charmap

* lang: Translate the degree symbol

* lang: Unbreak/cleanup DEBUG_SEC_LANG

* lang: Improve meaning of comment

* lang: Split charset conversions into an aux lib for future use

* lang: Implement lang-map.py to extract the translation symbol map

- Extracts the translatable symbol map for further use
- Computes a stable "language signature" from the map itself
- Optionally patches the binary update the symbols

* lang: Check for translation recoding problems

* lang: Implement a transliteration map to post-process translations

TRANS_CHARS is now used to replace unavailable symbols to the source
encoding, only while producing the language catalog.

* lang: Handle/check character replacements in lang-check

Filter the translation through TRANS_CHARS, so that the preview and
length check are performed correctly for expanding replacements such as
'ß' to 'ss'.

* lang: Implement lang-build.py to generate the final language catalog

* Cleanup .gitignore

* lang: Drop txt language files

* lang: Remove outdated translation scripts and obsolete docs

* lang: Update build scripts for new infrastructure

* lang: [no] Integrate accents from po/new/no.po

We now support accents natively

* lang: Remove redundant directory po/new/

* lang: Fix encoding of LCD characters in PO files

* lang: [hr] Fix wrapping in MSG_CRASH_DET_ONLY_IN_NORMAL

* lang: Sort and reformat PO files for further massaging

* lang: Switch to developer (dot) comments for PO metadata

* lang: Allow the IGNORE annotation to skip extraction

* lang: Fix missing/broken language metadata in sources

* lang: Add update-pot.sh and regenerate po/Firmware.pot

* lang: Add update-po.sh and refresh all PO files

* lang: Add summary documentation about the new translation workflow

* Add more ignored files

* CI: Add new required dependencies to travis

* lang: lang-build: Improve warning message

"referenced" was really meaning that data is being duplicated.

* lang: Respect the language order as defined in config.sh

This correctly splits normal and community-made entries during language
selection.

* lang: More typos in the documentation

* lang: Check for the maximum size of each language

Each table needs to fit within LANG_SIZE_RESERVED

* lang: Properly align _SEC_LANG to page boundaries

... instead of relying on _SEC_LANG_TABLE to calculate the offset

* lang: Build support for dual-language hex files

Detect the printer type by checking the current variant type.

On printers with no xflash (MK2*), generate one hex file for each
additional language file by patching the built-in secondary language
table during the build process

* lang: Mention lang-patchsec.py

* lang: Use color() instead of tput for clarity

* lang: Allow disabling terminal colors with NO_COLOR/TERM=dumb

* lang: Consistent use of redirection in config.sh

* lang: Stricter variant-type check for xflash support

* lang: Output size stats when building double-language hex files

* lang: Respect NO_COLOR in lang-check.py

* lang: Check for repeated/incorrect annotations

Catch errors such as "c=1 c=2"

* lang: Correct MSG_SLIGHT_SKEW/MSG_SEVERE_SKEW annotations

* lang: [it] Improve MSG_*_SKEW translation

* lang: Use INTLHEX instead of OUTHEX_P/S for configuration

We already have OUTHEX which is the compiled firmware.

Use INTLHEX for the final internationalized firmware, which is less
confusing. Also, assume it being a prefix for all generated hex
files, which reduces the number of variables set.

* lang: Move lang_map to lib.io for further use

* lang: lang-check: Accept a firmware map file to suppress unused string warnings

* lang: Use the map file to reduce useless warnings during fw-build

* lang: lang-check: Also suppress unused empty annotations

* lang: Fix MSG_MOVE_CARRIAGE_TO_THE_TOP_Z annotation

Refresh pot file

* lang: lang-check: Do not warn about same-word translations by default

Do not warn when one-word translations such as "No" result in "No" also
in other languages, since this is common in latin languages.

Allow to re-enable the warning with --warn-same

* lang: lang-build: Handle same-source/translation efficiently

* lang: [it] Explicitly add On/Off/Reset/Wizard to suppress warnings

Instead of displaying a warning, supress the warning and explicitly
translate each entry using english (which is the common/acceptable
word in these cases).

* lang: [it] Suppress more warnings

* lang: lang-check: Add intermediate "suggest" warning category

Warnings in the "suggest" category as shown as [S] as based on pure
speculation from the checking tool, such as the translation being
significantly shorter than the original.

As a result, they can be suppressed with --no-suggest

* lang: Return translation status from lang-check

- 0 if the translation only contains suggestions
- 1 if the translation contains warnings or errors

Check for the exit status in fw-build.sh, but do nothing at the moment
except printing a non-fatal error.

* lang: Remove "trim_trailing_whitespace=false" for po files

PO files got cleaned up/rewritten. We can now ensure they stay
consistent.

* lang: [sv] Re-integrate changes from 70c73cb

* lang: [no] Reintegrate changes from @pkg2000
2022-06-16 15:03:30 +02:00
..
variants Disable pullup crash test 2022-02-15 09:07:18 +01:00
adc.c Change printf_P without format arguments and NL to puts_P only 2021-01-22 18:56:05 +02:00
adc.h
asm.h GETPC: Do not manipulate the 32bit return address 2021-06-19 13:56:40 +02:00
AutoDeplete.cpp Comment. 2019-01-04 19:56:15 +01:00
AutoDeplete.h Add filament auto deplete engine for multi-material prints with MMUv2. 2019-01-03 22:58:25 +01:00
backlight.cpp Add newline at the end of file 2020-09-15 14:56:41 +02:00
backlight.h General fixes and improvements to code 2019-10-31 19:07:20 +02:00
BlinkM.cpp
BlinkM.h
boards.h
bootapp.c Remove unused/broken bootapp code 2021-03-03 16:31:30 +02:00
bootapp.h Fix usage of RAMEND 2021-06-12 13:16:12 +02:00
cardreader.cpp New PO-based language translation support (#3471) 2022-06-16 15:03:30 +02:00
cardreader.h Change nrFiles from int16_t to uint16_t 2021-07-20 08:10:07 +02:00
cmdqueue.cpp Add a uart RX timeout 2022-02-11 12:49:11 +01:00
cmdqueue.h Add a uart RX timeout 2022-02-11 12:49:11 +01:00
config.h New PO-based language translation support (#3471) 2022-06-16 15:03:30 +02:00
Configuration_adv.h Add def M120_M121_ENABLED to Configuration_adv.h 2021-03-11 15:00:49 +01:00
Configuration.cpp some improvements 2019-07-10 16:29:40 +02:00
Configuration.h Version changed (3.11.1-RC1 build 4987) 2022-06-13 12:03:48 +02:00
ConfigurationStore.cpp Report travel acceleration in M503 2021-02-03 11:20:28 +01:00
ConfigurationStore.h Implement separate travel acceleration (M204 T) 2021-02-03 11:20:28 +01:00
conv2str.cpp
conv2str.h
Dcodes.cpp * Remove redundant externs already included with temperature.h 2021-07-20 09:12:14 +02:00
Dcodes.h Improve/fix D23 for M2.5/S printers 2021-06-25 08:46:55 +02:00
doxyfile Updated doxygen docs to work better with confluence. 2019-07-19 13:51:55 +02:00
eeprom.cpp Merge pull request #3055 from awenelo/add-satin-sheet 2021-04-22 07:13:32 +02:00
eeprom.h Update doxygen documentation 2022-02-07 19:41:14 +01:00
fastio.h Remove the extra copy of CRITICAL_SECTION from fastio 2021-01-29 18:30:16 +01:00
Firmware.ino
first_lay_cal.cpp Gracefully dump the queue + fixes to fancheck 2020-11-09 21:49:56 +02:00
first_lay_cal.h Rename lay1cal_preheat() to lay1cal_wait_preheat(). 2019-09-12 00:19:20 +02:00
fsensor.cpp Silence bUpdateEEPROM unused warning in MK3 variant 2021-02-01 07:09:44 +01:00
fsensor.h MK3s IR sensor improvement (#2698) 2020-06-03 16:14:56 +02:00
heatbed_pwm.cpp Remove unnecessary assignment 2021-06-21 06:47:59 +02:00
la10compat.cpp Re-adjust LA10->15 conversion 2020-09-07 21:44:34 +02:00
la10compat.h Adjust E-jerk in LA10 compatibility mode 2020-02-03 15:42:27 +01:00
language.c New PO-based language translation support (#3471) 2022-06-16 15:03:30 +02:00
language.h New PO-based language translation support (#3471) 2022-06-16 15:03:30 +02:00
lcd.cpp Add some warnings in lcd_buttons_update 2021-06-19 13:46:10 +02:00
lcd.h Handle Long-Press in the main loop 2021-06-17 20:07:01 +02:00
le.sh make all shell scripts executable 2018-12-10 07:09:03 -07:00
macros.h More macros 2020-09-11 18:48:44 +03:00
Marlin_main.cpp New PO-based language translation support (#3471) 2022-06-16 15:03:30 +02:00
Marlin.h Merge branch 'MK3_3.11.1' into MK3_3.10.2 2022-04-07 14:05:34 +02:00
MarlinSerial.cpp Merge pull request #2982 from DRracer/codesize 2021-01-26 12:04:39 +01:00
MarlinSerial.h More than 7.5KB saved by slight refactoring of printing to serial line 2019-07-12 10:10:56 +02:00
menu.cpp Remove redundant extern variable lcd_encoder from menu.cpp 2021-07-20 09:12:14 +02:00
menu.h Cardreader progressbar code 2021-02-25 20:25:32 +02:00
mesh_bed_calibration.cpp Use fabs() instead of abs() when using floats 2021-07-20 08:16:18 +02:00
mesh_bed_calibration.h Calibration: detect biased PINDA and retry calibration 2021-03-12 05:04:49 +01:00
mesh_bed_leveling.cpp 7x7 points mesh bed leveling 2019-02-14 10:57:58 +02:00
mesh_bed_leveling.h
messages.c New PO-based language translation support (#3471) 2022-06-16 15:03:30 +02:00
messages.h Update ////MSG... for lang-add.sh 2022-03-16 09:01:14 +01:00
mmu.cpp New PO-based language translation support (#3471) 2022-06-16 15:03:30 +02:00
mmu.h Show FINDA state as N/A if last received response is older than 1s. 2019-10-31 17:45:22 +01:00
motion_control.cpp Improve mc_arc() parameters 2021-07-20 09:03:50 +02:00
motion_control.h Improve mc_arc() parameters 2021-07-20 09:03:50 +02:00
optiboot_xflash.cpp optiboot_xflash comment about w25x20cl messages 2021-06-21 07:21:40 +02:00
optiboot_xflash.h Rename w25x20cl to xflash 2021-04-06 10:16:47 +02:00
pat9125.c Fix misleading indentation warnings by expanding tabs 2021-06-21 06:52:52 +02:00
pat9125.h Isolate more pat9125 code 2020-08-20 15:34:46 +02:00
pins_Einsy_1_0.h Allow SN get only on the Einsy 2022-02-11 13:11:13 +01:00
pins_Rambo_1_0.h MK2.5 IR_SENSOR_PIN modified 2019-02-11 14:32:21 +01:00
pins_Rambo_1_3.h Still use SWI2C on RAMBo10a boards 2020-09-27 14:29:07 +02:00
pins.h Move SDA/SCL pins into pins.h for fastio compatibility 2021-01-29 17:48:59 +01:00
planner.cpp Use fabs() instead of abs() when using floats 2021-07-20 08:16:18 +02:00
planner.h Use uint8_t consistently for the block buffer's index 2021-06-22 06:59:57 +02:00
printers.h Remove commented out defines. 2019-07-10 17:40:33 +02:00
qr_solve.cpp
qr_solve.h
rbuf.c
rbuf.h
Sd2Card.cpp Update reference URL 2020-03-15 19:04:02 +09:00
Sd2Card.h Fix for Toshiba FlashAir (or other) SD card initialization - add clock cycles between sending CMD0 and CMD8. Redone for MK3 branch) 2019-08-08 15:45:59 -04:00
Sd2PinMap.h Move SDA/SCL pins into pins.h for fastio compatibility 2021-01-29 17:48:59 +01:00
SdBaseFile.cpp Return SdBaseFile into previous state 2021-01-28 09:41:30 +01:00
SdBaseFile.h Remove temporary changes from SdBaseFile.h 2021-01-28 09:42:50 +01:00
SdFatConfig.h
SdFatStructs.h
SdFatUtil.cpp Introduce STACK_GUARD_MARGIN in all variants 2021-06-12 12:08:53 +02:00
SdFatUtil.h Introduce STACK_GUARD_MARGIN in all variants 2021-06-12 12:08:53 +02:00
SdFile.cpp SDFile - fix errorneous offset computation 2021-03-30 11:33:42 +02:00
SdFile.h Remove commented debug code 2021-02-10 11:18:59 +01:00
SdInfo.h
SdVolume.cpp
SdVolume.h Extract gcode filter from SdBaseFile into SdFile + optimization 2021-01-27 09:33:28 +01:00
Servo.cpp change boolean to bool 2021-07-20 08:03:17 +02:00
Servo.h
sm4.c Merge pull request #2789 from wavexx/MK3_TMC2130_DEDGE 2021-01-29 11:13:09 +01:00
sm4.h Fix sm4.h line ending 2021-01-22 18:57:24 +02:00
sound.cpp Fix misleading indentation warnings by expanding tabs 2021-06-21 06:52:52 +02:00
sound.h Remove unused Sound_Save() function declaration 2021-07-20 08:51:57 +02:00
speed_lookuptable.cpp Move speed lookup defs into a separate source 2019-05-24 17:08:32 +02:00
speed_lookuptable.h Correct the C implementation for MultiU16X8toH16 2021-07-20 08:10:36 +02:00
spi.c
spi.h
static_assert.h static_assert - portable solution compatible with C++98 2018-09-27 19:59:29 +02:00
stepper.cpp Change the pullup test 2022-02-08 10:53:47 +01:00
stepper.h Move reset LA state from G80 to M84 2020-04-29 22:51:23 +02:00
stk500.h
swi2c.c Merge remote-tracking branch 'upstream/MK3' into MK3_PAT9125_I2C 2021-01-29 18:28:55 +01:00
swi2c.h
swspi.cpp
swspi.h
system_timer.h ALTFAN implementation (#2692) 2020-06-01 17:58:15 +02:00
temperature.cpp Merge branch 'MK3_3.11.1' into MK3_3.10.2 2022-04-07 14:05:34 +02:00
temperature.h Merge pull request #3320 from prusa3d/MK3_3.10.1 2021-12-17 14:02:13 +01:00
thermistortables.h Implement MIN/MAX AMBIENT safety checks 2020-08-01 17:38:10 +02:00
timer02.c split timer0 and timer2 initialization. Move timer2 init early 2021-01-31 17:18:32 +02:00
timer02.h split timer0 and timer2 initialization. Move timer2 init early 2021-01-31 17:18:32 +02:00
Timer.cpp Fix Timer_test broken by conditional translation for SYSTEM_TIMER_2. 2019-01-28 19:29:31 +01:00
Timer.h Code refactoring 2021-01-20 11:46:25 +01:00
TimerRemaining.h Fix Timer_test broken by conditional translation for SYSTEM_TIMER_2. 2019-01-28 19:29:31 +01:00
tmc2130.cpp Remove redundant extern variable is_usb_printing from tmc2130.cpp 2021-07-20 09:12:14 +02:00
tmc2130.h Scale extruder motor current linearly with speed. (#2813) 2021-04-23 16:06:28 +02:00
tone04.c Merge remote-tracking branch 'upstream/MK3' into MK3_PAT9125_I2C 2021-01-29 18:28:55 +01:00
tone04.h ALTFAN implementation (#2692) 2020-06-01 17:58:15 +02:00
twi.c Switch twi.c to fastio 2021-01-29 17:51:38 +01:00
twi.h Be more compliant in the I2C protocol 2020-09-28 20:21:07 +02:00
uart2.c Change printf_P without format arguments and NL to puts_P only 2021-01-22 18:56:05 +02:00
uart2.h MMU - communication, check after start, code cleaning 2018-08-07 20:37:59 +02:00
ultralcd.cpp New PO-based language translation support (#3471) 2022-06-16 15:03:30 +02:00
ultralcd.h Temp. cal. -> PINDA cal. 2022-03-07 11:47:52 +01:00
uni_avr_rpi.h
util.cpp Correctly read FW_VERSION_NR array from progmem 2021-06-28 06:36:26 +02:00
util.h M552 - Printer IP address 2021-02-02 13:21:16 +02:00
vector_3.cpp
vector_3.h
xflash_dump.cpp xfdump: correctly erase all sectors in xfdump_erase 2021-06-22 19:07:49 +02:00
xflash_dump.h Crash if pullups get enabled on the thermistor inputs 2022-02-01 12:34:07 +01:00
xflash_layout.h Fixup the DUMP_MAGIC constant 2021-06-22 00:04:39 +02:00
xflash.c xflash: add xflash_multipage_program and documentation 2021-06-08 15:25:16 +02:00
xflash.h xflash: add xflash_multipage_program and documentation 2021-06-08 15:25:16 +02:00
xyzcal.cpp Implement an online crash dumper for MK2.5 boards 2021-06-12 13:37:20 +02:00
xyzcal.h Calibration: detect biased PINDA and retry calibration 2021-03-12 05:04:49 +01:00