Commit Graph

55 Commits

Author SHA1 Message Date
Yuri D'Elia
e37435b53f Merge remote-tracking branch 'upstream/MK3_3.11.1' into mk311_sync 2022-07-04 16:14:23 +02:00
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
715f466fda Add Norwegian 2022-02-22 11:56:01 +01:00
ingbrzy
9f093ee404
typo 2022-02-11 12:49:41 +01:00
Alex Voinea
bf45d4dcd1 Make the compiler align the lang reserved area to the spm page boundary 2022-02-10 20:19:52 +01:00
Alex Voinea
e358cb2b78 Fix DEBUG_SEC_LANG 2022-02-10 20:19:52 +01:00
ingbrzy
834cc24e6c Add SK language 2022-02-10 19:01:04 +01:00
Alex Voinea
4d348fa953 Initial Romanian translation 2022-01-17 16:21:59 +01:00
Alex Voinea
1d491e772b
Expand maximum language count (#3345)
* Expand maximum language count
2022-01-13 16:01:36 +02:00
3d-gussner
1544a79b4e Add Lithuanian 2022-01-03 15:00:45 +01:00
3d-gussner
54d7e9331b Add Croatian 2022-01-03 11:25:15 +01:00
3d-gussner
75dc5bd410 Add Luxembourgish 2022-01-03 11:25:15 +01:00
3d-gussner
8911161f6b Add Hungarian
Fix typo
2022-01-03 11:25:15 +01:00
3d-gussner
7083529990 Add Slovanian 2022-01-03 11:25:15 +01:00
3d-gussner
f8a0d3ad7b Add Danish 2022-01-03 11:25:15 +01:00
3d-gussner
5bce397fab Add Swedish 2022-01-03 11:25:15 +01:00
3d-gussner
e02dd42765 Prepare for lot of community languages
The firmware is limited to how many languages can be stored in the xflash.
We will need to compile multiple language groups
2022-01-03 11:25:15 +01:00
Yuri D'Elia
5ae8bad0ba Introduce "xflash_layout" to organize XFLASH's content
Update the language code to use the new LANG_OFFSET definition
and remove hard-coded flash sizes.
2021-06-08 15:22:37 +02:00
Alex Voinea
9454f9d8ec Rename w25x20cl to xflash 2021-04-06 10:16:47 +02:00
3d-gussner
6d7d9089f7 Add defines and templates for community languages
Add `Community made` submenu to `Select language`
2021-03-01 08:22:43 +01:00
3d-gussner
d9b820690e Merge remote-tracking branch 'upstream/MK3' into MK3_Dutch
fix merge issues
2021-02-25 09:56:23 +01:00
Alex Voinea
eb007c35d2
Macros initial 2020-09-11 16:12:49 +03:00
3d-gussner
fef5b02010 Tag as community contribution 2020-09-09 12:34:25 +02:00
3d-gussner
6a7ae6231d Merge remote-tracking branch 'upstream/MK3' into MK3_Dutch 2020-01-08 16:02:00 +01:00
3d-gussner
9a7a909c6f Prepare adding new language 2019-09-14 15:49:33 +02:00
leptun
5fdaead663 Fix language related warnings in LANG_MODE 0 2019-07-29 15:55:42 +03:00
Marek Bel
5b9e7c4fe7 Fix warning: assignment makes pointer from integer without a cast. 2019-03-05 16:27:47 +01:00
Robert Pelnar
563052d015 New lang, arduino 1.8.5 - language.c - DEBUG_SEC_LANG fix 2018-10-18 15:39:08 +02:00
Robert Pelnar
4ca300bc39 Lang update, french translation
+resized reserved space
2018-09-11 03:43:05 +02:00
Marek Bel
88cce94cf9 Revert "Revert "Save 80B of flash and 8B of RAM and fix compiler warning:""
This reverts commit 77426b563a.
2018-07-23 13:35:38 +02:00
PavelSindler
77426b563a
Revert "Save 80B of flash and 8B of RAM and fix compiler warning:" 2018-07-17 11:28:44 +02:00
Marek Bel
2b5e63eb7f Fix compiler warnings in language.c and document _SEC_LANG_TABLE macro. 2018-07-12 17:23:50 +02:00
Robert Pelnar
febca066f2 New ML support - multiple languages in internal flash (MK25/MK2) 2018-06-23 01:31:38 +02:00
Robert Pelnar
603ed49001 New ML support - MK25 (without W25x20CL) 2018-06-21 20:57:22 +02:00
Robert Pelnar
79afb76839 New ML support - includes fixed 2018-06-21 19:58:13 +02:00
Robert Pelnar
a53b02567a New ML support - signature check
+updated scripts
+new script lang-build.sh (in future this script will replace make_lang.sh)
2018-06-18 19:37:20 +02:00
Robert Pelnar
7619e94040 New ML support - checksum and signature 2018-06-15 20:37:33 +02:00
Robert Pelnar
076258ff99 New ML support - cond.trans. for LANG_MODE 0 2018-06-10 16:28:15 +02:00
Robert Pelnar
fcfb4cdcae New ML support - menu tunning, startup
+config headers (bool - true/false replaced with 0/1)
+fixed include hierarchy
+removed comments
2018-06-10 16:04:32 +02:00
Robert Pelnar
f098707021 New ML support - W25X20CL - update process UI tunning 2018-06-10 00:22:28 +02:00
Robert Pelnar
dcd58d002c New ML support - W25X20CL
language selection from menu is working
2018-06-09 19:16:36 +02:00
Robert Pelnar
ebd8375313 New ML support - external flash W25X20CL - upgrade is working!!! (hardcoded to german)
+print test (LT_PRINT_TEST)
2018-06-09 17:49:41 +02:00
Robert Pelnar
c0946d8f04 New ML support - w25x20cl spi external flash support
+fixed some messages
+sec lang update test
2018-06-09 01:23:04 +02:00
Robert Pelnar
37f82118c8 New ML support - lang select menu fix 2018-06-08 02:03:25 +02:00
Robert Pelnar
59e65b7f47 New ML support - language select menu
+cond. translation for W25X20CL
2018-06-08 01:19:49 +02:00
Robert Pelnar
bd1e410228 New ML support - W25X20CL external spi flash support 2018-06-08 00:20:28 +02:00
Robert Pelnar
53d9d8bd8a New ML support - lang codes
+script tunning
2018-06-01 10:47:47 +02:00
Robert Pelnar
37e575f4bc New ML support - debug output, bootloader
bootapp - automaticaly erase flash when necessary
+test code
2018-05-30 19:29:52 +02:00
Robert Pelnar
4746c77195 New ML support - bootloader support and update proces test 2018-05-29 21:03:47 +02:00
Robert Pelnar
b3f4e1f6e4 New ML support - language menu 2018-05-28 19:41:16 +02:00