MK3_3.11.0_Lang fixes (#3404)
* Replace non-block space with space Fix of some editors create non-block spaces which cause issues. * Replace non-block space with space Fix single language run without config.sh OK * Update Slovak po files * revert delete of lang/po/Firmware_sk.po * Fix typos Unix format for md files
This commit is contained in:
parent
f1ff5907f4
commit
1bba7815fc
@ -6,9 +6,9 @@ We will use Dutch as an example here.
|
||||
|
||||
QR = placeholder for language in upper case
|
||||
|
||||
qr = placehodler for language in lower case
|
||||
qr = placeholder for language in lower case
|
||||
|
||||
AB = placeholder for hexadecial
|
||||
AB = placeholder for hexadecimal
|
||||
|
||||
Files needs to be modified
|
||||
- `../Firmware/language.h`
|
||||
@ -36,7 +36,7 @@ https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||
|
||||
- `../lang/lang-build.sh`
|
||||
|
||||
In section `#returns hexadecial data for lang code` add a case `*qr*) echo '0x71\0x72'`
|
||||
In section `#returns hexadecimal data for lang code` add a case `*qr*) echo '0x71\0x72'`
|
||||
|
||||
Example:
|
||||
`*nl*) echo '\x6c\x6e' ;;` !!! IMPORTANT that the hex values are switched so 'nl' is here in 'ln' !!!
|
||||
@ -185,7 +185,7 @@ To prepare the actual language translation files we need create the `lang_en_qr.
|
||||
```
|
||||
qr_filtered.po
|
||||
qr_new.po
|
||||
noasci.txt
|
||||
nonascii.txt
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Version 1.0.1 Build 10
|
||||
# Version 1.0.1 Build 12
|
||||
#
|
||||
# clean.sh - multi-language support script
|
||||
# Remove all language output files from lang folder.
|
||||
@ -25,15 +25,8 @@
|
||||
# Use `git rev-list --count HEAD lang-clean.sh`
|
||||
# to get Build Nr
|
||||
# 25 Jan. 2022, 3d-gussner, clean up lang-import.sh temproray files
|
||||
# 14 Feb. 2022, 3d-gussner, Fix single language run without config.sh OK
|
||||
#############################################################################
|
||||
# Config:
|
||||
if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
|
||||
if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo "$(tput setaf 1)Config NG!$(tput sgr0)" >&2; exit 1; fi
|
||||
|
||||
if [ ! -z "$COMMUNITY_LANGUAGES" ]; then
|
||||
LANGUAGES+=" $COMMUNITY_LANGUAGES"
|
||||
fi
|
||||
|
||||
result=0
|
||||
|
||||
rm_if_exists()
|
||||
@ -83,6 +76,14 @@ echo "$(tput setaf 2)lang-clean.sh started$(tput sgr0)" >&2
|
||||
#Clean languages
|
||||
echo "lang-clean languages:$(tput setaf 2)$LANGUAGES$(tput sgr0)" >&2
|
||||
if [ -e $1 ]; then
|
||||
# Config:
|
||||
if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
|
||||
if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo "$(tput setaf 1)Config NG!$(tput sgr0)" >&2; exit 1; fi
|
||||
|
||||
if [ ! -z "$COMMUNITY_LANGUAGES" ]; then
|
||||
LANGUAGES+=" $COMMUNITY_LANGUAGES"
|
||||
fi
|
||||
|
||||
for lang in $LANGUAGES; do
|
||||
clean_lang $lang
|
||||
done
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Version 1.0.1 Build 18
|
||||
# Version 1.0.1 Build 23
|
||||
#
|
||||
# lang-export.sh - multi-language support script
|
||||
# for generating lang_xx.po
|
||||
@ -25,18 +25,11 @@
|
||||
# Use `git rev-list --count HEAD lang-export.sh`
|
||||
# to get Build Nr
|
||||
# 25 Jan. 2022, 3d-gussner, Replace German HD44780 A00 ROM 'äöüß' to UTF-8 'äöüß'
|
||||
# 14 Feb. 2022, 3d-gussner, Fix single language run without config.sh OK
|
||||
#############################################################################
|
||||
# Config:
|
||||
if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
|
||||
if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo "$(tput setaf 1)Config NG!$(tput sgr 0)" >&2; exit 1; fi
|
||||
|
||||
echo "$(tput setaf 2)lang-export.sh started$(tput sgr 0)" >&2
|
||||
|
||||
if [ ! -z "$COMMUNITY_LANGUAGES" ]; then
|
||||
LANGUAGES+=" $COMMUNITY_LANGUAGES"
|
||||
fi
|
||||
echo "$(tput setaf 2)lang-export languages:$LANGUAGES$(tput sgr 0)" >&2
|
||||
|
||||
# relative path to source folder
|
||||
SRCDIR="../Firmware"
|
||||
|
||||
@ -44,7 +37,16 @@ SRCDIR="../Firmware"
|
||||
LNG=$1
|
||||
|
||||
# if no arguments, 'all' is selected (all po and also pot will be generated)
|
||||
if [ -z "$LNG" ]; then LNG=all; fi
|
||||
if [ -z "$LNG" ]; then
|
||||
LNG=all;
|
||||
# Config:
|
||||
if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
|
||||
if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo "$(tput setaf 1)Config NG!$(tput sgr 0)" >&2; exit 1; fi
|
||||
if [ ! -z "$COMMUNITY_LANGUAGES" ]; then
|
||||
LANGUAGES+=" $COMMUNITY_LANGUAGES"
|
||||
fi
|
||||
echo "$(tput setaf 2)lang-export languages:$LANGUAGES$(tput sgr 0)" >&2
|
||||
fi
|
||||
|
||||
# if 'all' is selected, script will generate all po files and also pot file
|
||||
if [ "$LNG" = "all" ]; then
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Version 1.0.1 Build 25
|
||||
# Version 1.0.1 Build 36
|
||||
#
|
||||
# lang-import.sh - multi-language support script
|
||||
# for importing translated xx.po
|
||||
@ -35,16 +35,20 @@
|
||||
# new argruments `--information` `--import-check`
|
||||
# 11 Jan. 2022, ingbrzy, Add Slovak letters
|
||||
# 11 Feb. 2022, 3d-gussner, Change to python3
|
||||
# 14 Feb. 2022, 3d-gussner, Replace non-block space with space
|
||||
# Fix single language run without config.sh OK
|
||||
#############################################################################
|
||||
# Config:
|
||||
if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
|
||||
if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo "$(tput setaf 1)Config NG!$(tput sgr 0)" >&2; exit 1; fi
|
||||
|
||||
echo "$(tput setaf 2)lang-import.sh started$(tput sgr 0)" >&2
|
||||
|
||||
LNG=$1
|
||||
# if no arguments, 'all' is selected (all po and also pot will be generated)
|
||||
if [ -z "$LNG" ]; then LNG=all; fi
|
||||
if [ -z "$LNG" ]; then
|
||||
LNG=all;
|
||||
# Config:
|
||||
if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
|
||||
if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo "$(tput setaf 1)Config NG!$(tput sgr 0)" >&2; exit 1; fi
|
||||
fi
|
||||
|
||||
if [[ ! -z "$COMMUNITY_LANGUAGES" && "$LNG" = "all" ]]; then
|
||||
LANGUAGES+=" $COMMUNITY_LANGUAGES"
|
||||
@ -421,6 +425,8 @@ fi
|
||||
#replace UTF-8 'μ' to HD44780 A00 'μ'
|
||||
#replace 'μ' with 'A00 ROM μ'
|
||||
sed -i 's/\xce\xbc/\\xe4/g' $LNG'_filtered.po'
|
||||
#replace non-break space with space
|
||||
sed -i 's/\xc2\xa0/ /g' $LNG'_filtered.po'
|
||||
|
||||
#check for nonasci characters except HD44780 ROM A00 'äöüß'
|
||||
if grep --color='auto' -P -n '[^\x00-\x7F]' $LNG'_filtered.po' >nonascii.txt; then
|
||||
@ -463,6 +469,7 @@ echo "$(tput setaf 2)Finished with $LNGISO$(tput sgr 0)" >&2
|
||||
sed -i 's/""/"\\x00"/g' lang_en_$LNG.txt
|
||||
#remove CR
|
||||
sed -i "s/\r//g" lang_en_$LNG.txt
|
||||
|
||||
#check new lang
|
||||
python3 ../../lang-check.py $LNG --warn-empty
|
||||
python3 ../../lang-check.py $LNG --information >$LNG-output.txt
|
||||
|
@ -7,8 +7,8 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: sk\n"
|
||||
"Project-Id-Version: Prusa-Firmware\n"
|
||||
"POT-Creation-Date: Ne 13. február 2022, 08:09:46 CET\n"
|
||||
"PO-Revision-Date: Ne 13. február 2022, 08:09:46 CET\n"
|
||||
"POT-Creation-Date: Mon 14 Feb 2022 07:49:28 AM CET\n"
|
||||
"PO-Revision-Date: Mon 14 Feb 2022 07:49:28 AM CET\n"
|
||||
"Language-Team: \n"
|
||||
"X-Generator: Poedit 2.0.7\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
@ -7,8 +7,8 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: sk\n"
|
||||
"Project-Id-Version: Prusa-Firmware\n"
|
||||
"POT-Creation-Date: Ne 13. február 2022, 08:09:46 CET\n"
|
||||
"PO-Revision-Date: Ne 13. február 2022, 08:09:46 CET\n"
|
||||
"POT-Creation-Date: Mon 14 Feb 2022 07:49:28 AM CET\n"
|
||||
"PO-Revision-Date: Mon 14 Feb 2022 07:49:28 AM CET\n"
|
||||
"Language-Team: \n"
|
||||
"X-Generator: Poedit 2.0.7\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
@ -14,7 +14,7 @@
|
||||
- run modified `fw-build.sh`
|
||||
- `not_tran<variant>.txt` should be reviewed and added as these are potential missing translations
|
||||
- copy `not_tran<variant>.txt` as `lang_add.txt`
|
||||
- check if there are things you don't want to translate or must be modifed
|
||||
- check if there are things you don't want to translate or must be modified
|
||||
- als check that the strings do not start with `spaces` as the scripts doesn't handle these well at this moment.
|
||||
- run `lang-add.sh lang_add.txt` to add the missing translations to `lang_en.txt` and `lang_en_??.txt`
|
||||
- `not_used<variant>.txt` should only contain messages that aren't used in this variant like MK2.5/S vs MK3/S
|
||||
@ -25,7 +25,7 @@
|
||||
- Send them to translators and reviewers or
|
||||
- copy these to `/lang/po/new` and
|
||||
- translate these with POEdit the newly added messages
|
||||
- easiest way is to choose `Validate`in POEdit as it shows you `errors` and the `missing transalations` / most likely the newly added at the top.
|
||||
- easiest way is to choose `Validate`in POEdit as it shows you `errors` and the `missing translations` / most likely the newly added at the top.
|
||||
- The new translated files are expected in `/lang/po/new` folder so store the received files these
|
||||
- run `lang-import.sh <language code (iso639-1)>` for each newly translated language
|
||||
- script improvement to import "all" and other things would be great.
|
||||
@ -45,11 +45,11 @@ The reset of this explanation is devoted to `LANG_MODE==1`:
|
||||
|
||||
`language.h`:
|
||||
```C++
|
||||
// section .loc_sec (originaly .progmem0) will be used for localized translated strings
|
||||
// section .loc_sec (originally .progmem0) will be used for localized translated strings
|
||||
#define PROGMEM_I2 __attribute__((section(".loc_sec")))
|
||||
// section .loc_pri (originaly .progmem1) will be used for localized strings in english
|
||||
// section .loc_pri (originally .progmem1) will be used for localized strings in english
|
||||
#define PROGMEM_I1 __attribute__((section(".loc_pri")))
|
||||
// section .noloc (originaly progmem2) will be used for not localized strings in english
|
||||
// section .noloc (originally progmem2) will be used for not localized strings in english
|
||||
#define PROGMEM_N1 __attribute__((section(".noloc")))
|
||||
#define _I(s) (__extension__({static const char __c[] PROGMEM_I1 = "\xff\xff" s; &__c[0];}))
|
||||
#define ISTR(s) "\xff\xff" s
|
||||
@ -57,7 +57,7 @@ The reset of this explanation is devoted to `LANG_MODE==1`:
|
||||
#define _T(s) lang_get_translation(s)
|
||||
```
|
||||
That explains the macros:
|
||||
- `_i` expands into `lang_get_translation((__extension__({static const char __c[] PROGMEM_I1 = "\xff\xff" s; &__c[0];})))` . Note the two 0xff's in the beginning of the string. `_i` allows for declaring a string directly inplace of C++ code, no string table is used. The downside of this approach is obvious - the compiler is not able/willing to merge duplicit strings into one.
|
||||
- `_i` expands into `lang_get_translation((__extension__({static const char __c[] PROGMEM_I1 = "\xff\xff" s; &__c[0];})))` . Note the two 0xff's in the beginning of the string. `_i` allows for declaring a string directly in-place of C++ code, no string table is used. The downside of this approach is obvious - the compiler is not able/willing to merge duplicate strings into one.
|
||||
- `_T` expands into `lang_get_translation(s)` without the two 0xff's at the beginning. Must be used in conjunction with MSG tables in `messages.h`. Allows to declare a string only once and use many times.
|
||||
- `_N` means not-translated. These strings reside in a different segment of memory.
|
||||
|
||||
@ -98,7 +98,7 @@ A simple list of strings that are not translated yet.
|
||||
|
||||
### `not_used.txt`
|
||||
A list os strings not currently used in this variant of the firmware or are obsolete.
|
||||
Example: There are MK2.5 specific messages that aren't used when you compile a MK3 variant and vice versa. So be carefull and double check the code if this message is obsolete or just not used due to the chosen variant.
|
||||
Example: There are MK2.5 specific messages that aren't used when you compile a MK3 variant and vice versa. So be careful and double check the code if this message is obsolete or just not used due to the chosen variant.
|
||||
|
||||
## Scripts
|
||||
|
||||
@ -185,7 +185,7 @@ Output files:
|
||||
|
||||
Output foler: ´/lang/po/new´
|
||||
|
||||
Needed improments to scrpit:
|
||||
Needed improvements to scripts:
|
||||
- add `all` argument
|
||||
- update `replace in <language> translations` to all known special characters the LCD display with Japanese ROM cannot display
|
||||
- move `lang_en_<language code>.txt` to folder `/lang`
|
||||
@ -200,8 +200,8 @@ Input:
|
||||
- $OUTDIR/sketch/*.o (all object files)
|
||||
|
||||
Outputs:
|
||||
- text.sym - formated symbol listing of section '.text'
|
||||
- $PROGMEM.sym - formated symbol listing of section '.progmemX'
|
||||
- text.sym - formatted symbol listing of section '.text'
|
||||
- $PROGMEM.sym - formatted symbol listing of section '.progmemX'
|
||||
- $PROGMEM.lss - disassembly listing file
|
||||
- $PROGMEM.hex - variables - hex
|
||||
- $PROGMEM.chr - variables - char escape
|
||||
@ -229,13 +229,13 @@ Description of process:
|
||||
|
||||
### `textaddr.sh`
|
||||
|
||||
Compiles `progmem1.var` and `lang_en.txt` files to `textaddr.txt` file (mapping of progmem addreses to text idenifiers).
|
||||
Compiles `progmem1.var` and `lang_en.txt` files to `textaddr.txt` file (mapping of progmem addresses to text identifiers).
|
||||
|
||||
Description of process:
|
||||
- check if input files exists
|
||||
- create sorted list of strings from progmem1.var and lang_en.txt
|
||||
- lines from progmem1.var will contain addres (8 chars) and english text
|
||||
- lines from lang_en.txt will contain linenumber and english text
|
||||
- lines from progmem1.var will contain address (8 chars) and english text
|
||||
- lines from lang_en.txt will contain line number and english text
|
||||
- after sort this will generate pairs of lines (line from progmem1 first)
|
||||
- result of sort is compiled with simple script and stored into file textaddr.txt
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user