Merge pull request #857 from XPila/MK3-new_lang

Mk3 new lang
This commit is contained in:
XPila 2018-06-21 19:18:26 +02:00 committed by GitHub
commit 64d814d2e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 154 additions and 9 deletions

View File

@ -2,7 +2,7 @@
#ifndef LANGUAGE_H
#define LANGUAGE_H
#define W25X20CL
//#define W25X20CL
#include "config.h"
#include <inttypes.h>

View File

@ -5611,7 +5611,7 @@ static void lcd_main_menu()
#endif
MENU_ITEM(submenu, _i("Support"), lcd_support_menu);////MSG_SUPPORT c=0 r=0
MENU_ITEM(submenu, _i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT c=0 r=0
// MENU_ITEM(submenu, _i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT c=0 r=0
#ifdef DEBUG_MENU_PRINTF_TEST
menu_item_printf_P(_menuItemNr, _lineNr, _N("Test %d %d %d"), 0, 1, 2);

61
lang/fw-clean.sh Normal file
View File

@ -0,0 +1,61 @@
#!/bin/sh
#
# fw-clean.sh - multi-language support script
# Remove all firmware output files from lang folder.
#
result=0
rm_if_exists()
{
if [ -e $1 ]; then
echo -n " removing '$1'..." >&2
if rm $1; then
echo "OK" >&2
else
echo "NG!" >&2
result=1
fi
fi
}
echo "fw-clean.sh started" >&2
rm_if_exists text.sym
rm_if_exists progmem1.sym
rm_if_exists progmem1.lss
rm_if_exists progmem1.hex
rm_if_exists progmem1.chr
rm_if_exists progmem1.var
rm_if_exists progmem1.txt
rm_if_exists textaddr.txt
rm_if_exists firmware.bin
rm_if_exists firmware.hex
rm_if_exists firmware_cz.hex
rm_if_exists firmware_de.hex
rm_if_exists firmware_es.hex
rm_if_exists firmware_it.hex
rm_if_exists firmware_pl.hex
rm_if_exists progmem.out
rm_if_exists textaddr.out
rm_if_exists update_lang.out
rm_if_exists update_lang_cz.out
rm_if_exists update_lang_de.out
rm_if_exists update_lang_es.out
rm_if_exists update_lang_it.out
rm_if_exists update_lang_pl.out
rm_if_exists lang.bin
rm_if_exists lang.hex
echo -n "fw-clean.sh finished" >&2
if [ $result -eq 0 ]; then
echo " with success" >&2
else
echo " with errors!" >&2
fi
case "$-" in
*i*) echo "press enter key"; read ;;
esac
exit $result

10
lang/iso639-1.txt Normal file
View File

@ -0,0 +1,10 @@
#language codes ISO639-1
# iso english localized
#-----------------------
# en English English
# de German Deutsch
# cs Czech Cestina
# es Spanish Espanol
# fr
# it Italian Italiano
# pl Polish Polski

View File

@ -90,7 +90,8 @@ generate_binary()
cat lang_en_$1.txt | sed '/^$/d;/^#/d' | sed -n 'n;p'
fi | sed 's/^\"\\x00\"$/\"\"/' > lang_$1.tmp
#create lang_xx.dat (binary text data file)
cat lang_$1.tmp | sed 's/^\"/printf \"/;s/"$/\\x00\"/' | sh >lang_$1.dat
# cat lang_$1.tmp | sed 's/^\"/\/bin\/echo -e \"/;s/"$/\\x00\"/' > lang_$1.shx
cat lang_$1.tmp | sed 's/^\"/\/bin\/echo -e \"/;s/"$/\\x00\"/' | sh >lang_$1.dat
#calculate number of strings
count=$(grep -c '^"' lang_$1.tmp)
echo "count="$count >&2
@ -118,8 +119,8 @@ generate_binary()
/bin/echo -n -e $(echo -n $((0x$chsum)) | awk "$awk_ui16") |\
dd of=lang_$1.bin bs=1 count=2 seek=8 conv=notrunc 2>/dev/null
#remove temporary files
rm -f lang_$1.tmp
rm -f lang_$1.dat
# rm -f lang_$1.tmp
# rm -f lang_$1.dat
}
if [ -z "$1" ]; then set 'all'; fi

57
lang/lang-clean.sh Normal file
View File

@ -0,0 +1,57 @@
#!/bin/sh
#
# clean.sh - multi-language support script
# Remove all language output files from lang folder.
#
result=0
rm_if_exists()
{
if [ -e $1 ]; then
echo -n " removing '$1'..." >&2
if rm $1; then
echo "OK" >&2
else
echo "NG!" >&2
result=1
fi
fi
}
clean_lang()
{
if [ "$1" = "en" ]; then
rm_if_exists lang_$1.tmp
else
rm_if_exists lang_en_$1.tmp
rm_if_exists lang_en_$1.dif
rm_if_exists lang_$1.ofs
rm_if_exists lang_$1.txt
fi
rm_if_exists lang_$1.bin
rm_if_exists lang_$1.dat
}
echo "lang-clean.sh started" >&2
clean_lang en
clean_lang cz
clean_lang de
clean_lang es
clean_lang fr
clean_lang it
clean_lang pl
echo -n "lang-clean.sh finished" >&2
if [ $result -eq 0 ]; then
echo " with success" >&2
else
echo " with errors!" >&2
fi
case "$-" in
*i*) echo "press enter key" >&2; read ;;
esac
exit $result

View File

@ -117,6 +117,11 @@ else
finish 1
fi
#convert bin to hex
echo -n " converting to hex..." >&2
$OBJCOPY -I binary -O ihex ./firmware.bin ./firmware.hex
echo "OK" >&2
#update _SEC_LANG in binary file if language is selected
echo -n " secondary language data..." >&2
if [ ! -z "$LNG" ]; then
@ -154,9 +159,20 @@ else
# echo "skipped" >&2
fi
#convert bin to hex
#echo -n " converting to hex..." >&2
#$OBJCOPY -I binary -O ihex ./firmware.bin ./firmware.hex
#echo "OK" >&2
#create binary file with all languages
rm -f lang.bin
if [ -e lang_cz.bin ]; then cat lang_cz.bin >> lang.bin; fi
if [ -e lang_de.bin ]; then cat lang_de.bin >> lang.bin; fi
if [ -e lang_es.bin ]; then cat lang_es.bin >> lang.bin; fi
if [ -e lang_it.bin ]; then cat lang_it.bin >> lang.bin; fi
if [ -e lang_pl.bin ]; then cat lang_pl.bin >> lang.bin; fi
#convert lang.bin to lang.hex
echo -n " converting to hex..." >&2
$OBJCOPY -I binary -O ihex ./lang.bin ./lang.hex
echo "OK" >&2
#append languages to hex file
cat ./lang.hex >> firmware.hex
finish 0