fix(bw): add missing UA characters, mapping (#4823)

This commit is contained in:
3djc
2024-03-31 07:34:29 +10:00
committed by GitHub
parent a1dd0831ea
commit 46f484e6e5
7 changed files with 59 additions and 26 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 571 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

+54 -25
View File
@@ -26,13 +26,13 @@
#include "translations/untranslated.h"
#if defined(TRANSLATIONS_FR)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'é', L'è', L'à', L'î', L'ç',
};
#if !defined(COLORLCD)
#define UTF8_SUBS_LUT
static wchar_t _utf8_substitution_lut[] = {
static uint16_t _utf8_substitution_lut[] = {
L'Â', L'A',
L'À', L'A',
L'Ê', L'E',
@@ -50,15 +50,15 @@ static wchar_t _utf8_substitution_lut[] = {
};
#endif
#elif defined(TRANSLATIONS_DA)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'å', L'æ', L'ø', L'Å', L'Æ', L'Ø',
};
#elif defined(TRANSLATIONS_DE)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'Ä', L'ä', L'Ö', L'ö', L'Ü', L'ü', L'ß',
};
#elif defined(TRANSLATIONS_CZ)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'á', L'č', L'é', L'ě', L'í', L'ó', L'ř',
L'š', L'ú', L'ů', L'ý', L'Á', L'Í', L'Ř',
L'Ý', L'ž', L'É', L'ň',
@@ -66,7 +66,7 @@ static wchar_t _utf8_lut[] = {
#if !defined(COLORLCD)
#define UTF8_SUBS_LUT
static wchar_t _utf8_substitution_lut[] = {
static uint16_t _utf8_substitution_lut[] = {
L'Ě', L'ě',
L'Š', L'š',
L'Č', L'č',
@@ -78,33 +78,33 @@ static wchar_t _utf8_substitution_lut[] = {
};
#endif
#elif defined(TRANSLATIONS_ES)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'Ñ', L'ñ', L'Á', L'á', L'É', L'é', L'Í',
L'í', L'Ó', L'ó', L'ú',
};
#elif defined(TRANSLATIONS_PT)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'Á', L'á', L'Â', L'â', L'Ã', L'ã', L'À',
L'à', L'Ç', L'ç', L'É', L'é', L'Ê', L'ê',
L'Í', L'í', L'Ó', L'ó', L'Ô', L'ô', L'Õ',
L'õ', L'Ú', L'ú',
};
#elif defined(TRANSLATIONS_FI)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'å', L'ä', L'ö', L'Å', L'Ä', L'Ö',
};
#elif defined(TRANSLATIONS_IT)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'à', L'ù',
};
#elif defined(TRANSLATIONS_PL)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'ą', L'ć', L'ę', L'ł', L'ń', L'ó', L'ś',
L'ż', L'ź', L'Ą', L'Ć', L'Ę', L'Ł', L'Ń',
L'Ó', L'Ś', L'Ż', L'Ź',
};
#elif defined(TRANSLATIONS_RU)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'А', L'Б', L'В', L'Г', L'Д', L'Е', L'Ж',
L'З', L'И', L'Й', L'К', L'Л', L'М', L'Н',
L'О', L'П', L'Р', L'С', L'Т', L'У', L'Ф',
@@ -117,20 +117,46 @@ static wchar_t _utf8_lut[] = {
L'я',
};
#elif defined(TRANSLATIONS_UA)
static wchar_t _utf8_lut[] = {
L'А', L'Б', L'В', L'Г', L'Д', L'Е', L'Ж',
L'З', L'И', L'Й', L'К', L'Л', L'М', L'Н',
L'О', L'П', L'Р', L'С', L'Т', L'У', L'Ф',
L'Х', L'Ц', L'Ч', L'Ш', L'Щ', L'Ъ', L'Ы',
L'Ь', L'Э', L'Ю', L'Я', L'а', L'б', L'в',
L'г', L'д', L'е', L'ж', L'з', L'и', L'й',
L'к', L'л', L'м', L'н', L'о', L'п', L'р',
L'с', L'т', L'у', L'ф', L'х', L'ц', L'ч',
L'ш', L'щ', L'ъ', L'ы', L'ь', L'э', L'ю',
L'я',
#if !defined(COLORLCD)
#define UTF8_SUBS_LUT
// Warning, albeit the following table looks useless
// It does translate Cyrillic to Latin
static uint16_t _utf8_substitution_lut[] = {
L'А', L'A',
L'а', L'a',
L'В', L'B',
L'С', L'C',
L'с', L'c',
L'Е', L'E',
L'е', L'e',
L'Н', L'H',
L'К', L'K',
L'М', L'M',
L'І', L'I',
L'і', L'i',
L'О', L'O',
L'о', L'o',
L'о', L'o',
L'Р', L'P',
L'р', L'p',
L'Т', L'T',
L'Х', L'X',
L'х', L'x',
L'у', L'y'
};
#endif
static uint16_t _utf8_lut[] = {
L'Б', L'Г', L'Ґ', L'Д', L'Є', L'Ж', L'З',
L'И', L'Ї', L'Й', L'Л', L'П', L'У', L'Ф',
L'Ц', L'Ч', L'Ш', L'Щ', L'Ь', L'Ю', L'Я',
L'б', L'в', L'г', L'ґ', L'д', L'є', L'ж',
L'з', L'и', L'ї', L'й', L'к', L'л', L'м',
L'н', L'п', L'т', L'ф', L'ц', L'ч', L'ш',
L'щ', L'ь', L'ю', L'я'
};
#elif defined(TRANSLATIONS_SE)
static wchar_t _utf8_lut[] = {
static uint16_t _utf8_lut[] = {
L'å', L'ä', L'ö', L'Å', L'Ä', L'Ö',
};
#else
@@ -138,6 +164,9 @@ static wchar_t _utf8_lut[] = {
#endif
#if !defined(NO_UTF8_LUT)
#define MAX_TRANSLATED_CHARS 107
static_assert(sizeof(_utf8_lut) / sizeof(_utf8_lut[0]) <= MAX_TRANSLATED_CHARS, "Number of translated chars exceeds the limit");
static unsigned char lookup_utf8_mapping(wchar_t w)
{
for (uint32_t i=0; i < DIM(_utf8_lut); i++) {
@@ -149,7 +178,7 @@ static unsigned char lookup_utf8_mapping(wchar_t w)
#endif
#if defined(UTF8_SUBS_LUT)
static wchar_t lookup_utf8_substitution(wchar_t w)
static uint16_t lookup_utf8_substitution(wchar_t w)
{
for (uint32_t i=0; i < DIM(_utf8_substitution_lut); i+=2) {
if (w == _utf8_substitution_lut[i])
+4
View File
@@ -507,6 +507,10 @@ else()
message( FATAL_ERROR "Unknown CPU_TYPE_FULL" )
endif()
if(TRANSLATIONS STREQUAL UA AND NOT TARGET_FLASH_SIZE STREQUAL 1M)
set(PXX2 OFF)
endif()
if(ENABLE_SERIAL_PASSTHROUGH)
set(CLI ON "Enable CLI")
endif()
+1 -1
View File
@@ -17,7 +17,7 @@ chars_it = u"""àù"""
chars_pl = u"""ąćęłńóśżźĄĆĘŁŃÓŚŻŹ"""
chars_pt = u"""ÁáÂâÃãÀàÇçÉéÊêÍíÓóÔôÕõÚú"""
chars_ru = u"""АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"""
chars_ua = u"""АБВГҐДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯабвгґдеєжзиіїйклмнопрстуфхцчшщьюя"""
chars_ua = u"""БГҐДЄЖЗИЇЙЛПУФЦЧШЩЬЮЯбвгґдєжзиїйклмнптфцчшщьюя"""
COUNT_EXTRA_CHARS = 21