Commit Graph

25 Commits

Author SHA1 Message Date
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
3d-gussner
19b4c333c0 Improve lang import and cleanup 2022-03-16 09:23:34 +01:00
3d-gussner
37662afdd1 Add LF 2022-02-03 08:05:49 +01:00
3d-gussner
fbe33ed28f Add POEdit .moand MAC generated .DS_Store 2022-02-02 17:23:31 +01:00
3d-gussner
c3347dd2cb Improve language scripts
- Add German `äöüß` support
- Add/improve checks
  - Check for syntax errors
  - Output for translators
- gitignore more temporary files
2022-02-02 17:23:31 +01:00
DRracer
fd6dbba06f
Merge branch 'MK3_3.10.1' into PFW-1271_PF-buildv20 2021-08-02 08:51:51 +02:00
Yuri D'Elia
a697d00647 tools: add __pycache__ to gitignore 2021-07-30 06:38:12 +02:00
3d-gussner
9f9203b280 Change atmega404 board flash argument to y
Use newer version of MK404-build.sh instead start the program
Added _RAM-<value> and _FLASH-<value> as OUTPUT_FILE_SUFFIX if someone builds an atmega404 firmware
Added some logic if IDE 1.8.13 is used
Added some logic if Arduino_boards 1.0.4 is used
Fixed typo
Restore original `Configuration.h` and `config.h` in case of cannceled script or failed compiling during next start of this script.
use function
Improve MK404 usage
2021-06-23 20:14:30 +02:00
3d-gussner
41da8862b4
MK3 3.9.0 Italian fix (#2663)
* Fix rm ... output issue
Remove files only if they exist

* Fix Italian missing translations
There have been only 362 instead of 365
Sorry for that, normally I double check this.

* Added `not_tran` and `not_used` files
This makes it easier to find missing or obsolate translations

* Revert "Added `not_tran` and `not_used` files"

This reverts commit a1b53dde663dc20a105fd3fa817e612ef999cb97.

These should be ignored

* Ignore ALL `not_tran`and `not_used` files
2020-05-13 20:51:13 +02:00
Marek Bel
4e7de776cd Disable TMC2130 linarity correction for MK3 to save FLASH to enable compilation. Add symlink /Firmware/variants/printers.h to .gitignore. 2019-07-10 17:07:00 +02:00
PavelSindler
e27fdafcec menu switch - initial 2019-02-28 19:42:09 +01:00
Robert Pelnar
d2a4cb4c49 Use _delay_ms instead of delay (fix - fast scrolling in sd card menu - temporary solution) 2019-02-04 12:20:07 +01:00
Marek Bel
052ae323f8 Merge branch 'MK3' into prusa3d-DEV_MK3 2019-01-15 16:58:36 +01:00
PavelSindler
72accdc5bb gitignore update 2018-11-29 13:51:24 +01:00
PavelSindler
abf20ef6a2 merged changes from public upstream (Prusa-Firmware repository) 2018-11-29 13:46:58 +01:00
PavelSindler
5f4bed8d72 add gitignore 2018-11-29 13:35:57 +01:00
Marek Bel
38dacaf07a Automate secondary language support build. 2018-11-26 20:24:24 +01:00
PavelSindler
436f5b5728 changed version 2018-10-04 17:40:38 +02:00
PavelSindler
d96b0d5f32 linearity correction define added (menu readded) 2018-08-30 11:28:12 +02:00
PavelSindler
135c4db5da gcode for filemant type initial version: just re-sending information to mmu 2018-08-01 15:43:13 +02:00
PavelSindler
5bda19b9f7 config for mmu updated 2018-07-26 14:59:49 +02:00
PavelSindler
d4106c2fe3 If homing all axes, move Z little bit higher before X and Y movements to protect steel sheet/heatbed 2018-06-11 11:13:49 +02:00
PavelSindler
5e120e6e52 power panic flow factor hotfix 2018-06-08 18:13:50 +02:00
Marek Bel
7cc8b743c2 Add .gitignore. Setup doxyfile. Create project documentation main page. Document property of static object constructors on gcc-avr. 2018-06-05 18:30:02 +02:00
PavelSindler
c5dd9dd654 gitignore 2017-12-02 00:19:47 +01:00