Commit Graph

776 Commits

Author SHA1 Message Date
3d-gussner
a01c19cade Change backup suffix from ~ to .bak 2022-06-20 17:00:42 +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
53046ffeee Update diacritics in Swedish and Norwegian Firmware_xx.po files 2022-05-24 09:06:46 +02:00
3d-gussner
44eb9d4ff9 Updated Norwegian files 2022-05-24 08:27:12 +02:00
3d-gussner
70c73cbf6b Pre-release po file update 2022-05-24 08:14:24 +02:00
3d-gussner
3ae4b6d329 Merge remote-tracking branch 'pkg2000/MK3_3.11.0' into HEAD
Fix merge issues and POEdit double `\\` to `\`
Update `lang_en_no.txt`
Enable Norwegian translation in `config.h`

Tested on MK404 MK3S
2022-05-24 07:28:10 +02:00
pkg2000
a319e32c7e Update no.po
hah, can you believe it. In Extruder info, nozzle fan is the extruder fan..
2022-04-20 17:30:02 +02:00
pkg2000
137e607fef Update no.po
Mistake in naming of FAN with capitol within Extruder info, under Support. Fixed here.
2022-04-20 16:38:55 +02:00
pkg2000
8cc89c7207 Update no.po
Sorry. last one. Unified fan names
2022-04-20 14:02:19 +02:00
pkg2000
859f6215a9 Update no.po
Changes based on @trondkla feedback. exceptions to his suggestions have been discussed and agreed upon (most were due to char. count and linebreak limitations.) Vocabulary/wording ready. now just need to test how everything render on the screen.
2022-04-20 13:57:56 +02:00
pkg2000
b03acf0d03 Update no.po
Changed printfan (printvifte) to Nozzle fan (dysevifte).
Wizard (Veileder) reference improved in longer text.
Cleaned up linebreaks
Bed level correct -> Planecorrection (Plankorreksjon).
few minor typos fixed and found

Warning: Gt desktop or Poedit keeps adding an extra \ , when using \x0a (Linebreak)
2022-04-06 16:47:26 +02:00
3d-gussner
14f07963ac Fix typo in Slovak thanks to Prusa test team 2022-04-05 15:07:45 +02:00
pkg2000
d00b20ee62 Update no.po
More fixes.
2022-03-31 17:22:23 +02:00
pkg2000
c2e56f6a4a Update no.po
Some new updates and fixes.
2022-03-31 17:12:51 +02:00
3d-gussner
d2a542b554 Update from from [commit](a05287cb2f) 2022-03-20 18:41:27 +01:00
3d-gussner
b244cedd7f Add Swedish pa to conversion
Update po files
2022-03-18 15:45:39 +01:00
3d-gussner
9a3f412aad Forgot saving one file 2022-03-17 18:33:53 +01:00
3d-gussner
8bd3b473c4 Last fixes in Swedish 2022-03-17 18:26:45 +01:00
3d-gussner
bf20d18711 Fix French check 2022-03-16 11:55:51 +01:00
3d-gussner
92e733fdcb Update po files 2022-03-16 11:37:24 +01:00
3d-gussner
3954c44bc9 update all languages files 2022-03-16 09:24:06 +01:00
3d-gussner
19b4c333c0 Improve lang import and cleanup 2022-03-16 09:23:34 +01:00
3d-gussner
7a64210043 Check if translation isn't equal to origin
Removed identical translations/origin all lang files incl. po files,
which saves some xflash space
2022-03-14 13:29:21 +01:00
3d-gussner
12b184cf68 Add missing MSG_SHEET_OFFSET to translations 2022-03-12 12:34:08 +01:00
3d-gussner
61695eebcc Add \x04Refresh translations 2022-03-12 11:55:25 +01:00
3d-gussner
3aab3b7148 Delete old translations
- `Current`
- `Used during print`
- `Error - static memory has been overwritten`
2022-03-12 11:23:45 +01:00
3d-gussner
7c55cf801b Fix additional merge issues
Update lang-??port.sh scripts
2022-03-12 10:51:26 +01:00
3d-gussner
764a1fd411 Merge remote-tracking branch 'upstream/MK3_3.11.0' into MK3_3.11.0_Improve_languages2
Fix Swedish merge issues
2022-03-12 09:44:00 +01:00
3d-gussner
7265174a93 Update lang-??port.sh documentation 2022-03-12 08:58:24 +01:00
3d-gussner
08332a8942
Merge pull request #3349 from 3d-gussner/MK3_3.11.0_Swedish
Swedish / Svenska / Sverige community translation
2022-03-12 08:55:30 +01:00
3d-gussner
00ec8bb01c Update all po files 2022-03-12 08:48:15 +01:00
3d-gussner
3e6c4ac6fd Fix Norgwegian merge issues
Update lang-??port.sh scripts for Norwegian
2022-03-12 08:46:46 +01:00
3d-gussner
ce5a9613ce Merge remote-tracking branch 'upstream/MK3_3.11.0' into MK3_3.11.0_Improve_languages2
Fix merge
2022-03-11 17:26:52 +01:00
3d-gussner
1f4da80609 Fix \0x Refresh and Sheet.. messages being added correctly 2022-03-11 15:35:30 +01:00
3d-gussner
18859a3609
Merge pull request #3427 from pkg2000/MK3_3.11.0
Norwegian
2022-03-11 15:14:31 +01:00
3d-gussner
b4492067a4
Merge branch 'MK3_3.11.0' into MK3_3.11.0_Swedish 2022-03-10 14:59:46 +01:00
3d-gussner
94f9a97344 Merge latest sv.po from https://github.com/prusa3d/Prusa-Firmware/pull/3353
create `lang_en_sv.txt` with `./lang-import.sh sv`
update `Firmware_sv.po` with `./lang-export.sh sv`
2022-03-10 14:49:05 +01:00
pkg2000
a4050b3e26 Update no.po
removed some identical strings
2022-03-10 14:44:30 +01:00
3d-gussner
f0a498abb1 Replace 'åÅ' with 'aA' 2022-03-09 06:37:15 +01:00
3d-gussner
5c0a443b4f Fix Norwegian after rebase 2022-03-07 11:47:53 +01:00
3d-gussner
f9f76520d9 Temp. cal. -> PINDA cal.
01234567890123456789
 Temp. cal.   [Off] old
 PINDA cal.   [Off] new

Temp. cal.  1/6     old
PINDA cal.    1/6   new

MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE

Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED

Update status line during PINDA cal.

Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`

Tried to update translations

Updated po files
2022-03-07 11:47:53 +01:00
3d-gussner
c1e971c2ad Change Choose extruder to Select extruder for consistant wording 2022-03-07 11:47:53 +01:00
3d-gussner
45cd904520 Remove duplicate Extruder fan:
Create MSG in messages to reuse it
Remove `Nozzle FAN`
Change Support -> Extruder info -> fan speeds
2022-03-07 11:47:53 +01:00
3d-gussner
bcd2b6f8bf Remove Choose filament as it is a duplicate of Select filament 2022-03-07 11:47:53 +01:00
3d-gussner
879803daa9 Temp. cal. -> PINDA cal.
01234567890123456789
 Temp. cal.   [Off] old
 PINDA cal.   [Off] new

Temp. cal.  1/6     old
PINDA cal.    1/6   new

MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE

Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED

Update status line during PINDA cal.

Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`

Tried to update translations

Updated po files
2022-03-07 11:47:52 +01:00
3d-gussner
7939142922 Change Choose extruder to Select extruder for consistant wording 2022-03-07 11:47:52 +01:00
3d-gussner
81d8c72cc4 Remove duplicate Extruder fan:
Create MSG in messages to reuse it
Remove `Nozzle FAN`
Change Support -> Extruder info -> fan speeds
2022-03-07 11:47:52 +01:00
3d-gussner
4a73cad3fd Remove Choose filament as it is a duplicate of Select filament 2022-03-07 11:47:52 +01:00
3d-gussner
ab48e9880e
Merge pull request #3215 from wavexx/lang_add_improvements
PFW-1297: lang-add.sh improvements
2022-03-07 11:47:11 +01:00
pkg2000
53bbd36cf3 Update no.po
And we try again before final audit.
2022-03-04 13:21:06 +01:00