From 026f2ccae22f02a1ca0bbdbe37b03927eff3fc31 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 20 Dec 2021 17:32:35 +0100 Subject: [PATCH] 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 --- Firmware/config.h | 11 +++++++---- Firmware/language.c | 14 +++++++------- Firmware/language.h | 12 ++++++------ Firmware/ultralcd.cpp | 8 ++++---- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Firmware/config.h b/Firmware/config.h index 5adba50df..a67536c43 100644 --- a/Firmware/config.h +++ b/Firmware/config.h @@ -61,13 +61,16 @@ #define LANG_SIZE_RESERVED 0x3000 // reserved space for secondary language (12288 bytes) //Community language support -#define COMMUNITY_LANG_NL // Community Dutch language -//#define COMMUNITY_LANG_QR // Community new language //..use this as a template and replace 'QR' +#define COMMUNITY_LANG_GROUP 1 -#if defined(COMMUNITY_LANG_NL) //|| defined(COMMUNITY_LANG_QR) //..use last part as a template and replace 'QR' -#define COMMUNITY_LANG_SUPPORT +#if (COMMUNITY_LANG_GROUP == 1) +#define COMMUNITY_LANG_GROUP1_NL // Community Dutch language +//#define COMMUNITY_LANG_GROUP1_QR // Community new language //..use this as a template and replace 'QR' #endif +#if (COMMUNITY_LANG_GROUP >=1 ) +#define COMMUNITY_LANGUAGE_SUPPORT +#endif // Sanity checks for correct configuration of XFLASH_DUMP options #if defined(XFLASH_DUMP) && !defined(XFLASH) #error "XFLASH_DUMP requires XFLASH support" diff --git a/Firmware/language.c b/Firmware/language.c index 9a1113b96..3cef01587 100644 --- a/Firmware/language.c +++ b/Firmware/language.c @@ -211,16 +211,16 @@ const char* lang_get_name_by_code(uint16_t code) case LANG_CODE_FR: return _n("Francais"); case LANG_CODE_IT: return _n("Italiano"); case LANG_CODE_PL: return _n("Polski"); -#ifdef COMMUNITY_LANG_SUPPORT //Community language support -#ifdef COMMUNITY_LANG_NL - case LANG_CODE_NL: return _n("Nederlands"); //community contribution -#endif // COMMUNITY_LANG_NL +#ifdef COMMUNITY_LANGUAGE_SUPPORT //Community language support +#ifdef COMMUNITY_LANG_GROUP1_NL + case LANG_CODE_NL: return _n("Nederlands"); //community Dutch contribution +#endif // COMMUNITY_LANG_GROUP1_NL //Use the 3 lines below as a template and replace 'QR' and 'New language' -//#ifdef COMMUNITY_LANG_QR +//#ifdef COMMUNITY_LANG_GROUP1_QR // case LANG_CODE_QR: return _n("New language"); //community contribution -//#endif // COMMUNITY_LANG_QR -#endif // COMMUNITY_LANG_SUPPORT +//#endif // COMMUNITY_LANG_GROUP1_QR +#endif // COMMUNITY_LANGUAGE_SUPPORT } return _n("??"); } diff --git a/Firmware/language.h b/Firmware/language.h index 736d522e3..7cbafd38d 100644 --- a/Firmware/language.h +++ b/Firmware/language.h @@ -94,15 +94,15 @@ typedef struct #define LANG_CODE_FR 0x6672 //!<'fr' #define LANG_CODE_IT 0x6974 //!<'it' #define LANG_CODE_PL 0x706c //!<'pl' -#ifdef COMMUNITY_LANG_SUPPORT //Community language support -#ifdef COMMUNITY_LANG_NL +#ifdef COMMUNITY_LANGUAGE_SUPPORT //Community language support +#ifdef COMMUNITY_LANG_GROUP1_NL #define LANG_CODE_NL 0x6e6c //!<'nl' -#endif // COMMUNITY_LANG_NL +#endif // COMMUNITY_LANG_GROUP1_NL //Use the 3 lines below as a template and replace 'QR', '0X7172' and 'qr' -//#ifdef COMMUNITY_LANG_QR +//#ifdef COMMUNITY_LANG_GROUP1_QR //#define LANG_CODE_QR 0x7172 //!<'qr' -//#endif // COMMUNITY_LANG_QR -#endif // COMMUNITY_LANG_SUPPORT +//#endif // COMMUNITY_LANG_GROUP1_QR +#endif // COMMUNITY_LANGUAGE_SUPPORT ///@} #if defined(__cplusplus) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index daac8d71c..4ea423567 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4442,7 +4442,7 @@ void menu_setlang(unsigned char lang) } } -#ifdef COMMUNITY_LANG_SUPPORT +#ifdef COMMUNITY_LANGUAGE_SUPPORT #ifdef XFLASH static void lcd_community_language_menu() { @@ -4458,7 +4458,7 @@ static void lcd_community_language_menu() MENU_END(); } #endif //XFLASH -#endif //COMMUNITY_LANG_SUPPORT && W52X20CL +#endif //COMMUNITY_LANGUAGE_SUPPORT && W52X20CL @@ -4492,11 +4492,11 @@ static void lcd_language_menu() return; } -#ifdef COMMUNITY_LANG_SUPPORT +#ifdef COMMUNITY_LANGUAGE_SUPPORT #ifdef XFLASH MENU_ITEM_SUBMENU_P(_T(MSG_COMMUNITY_MADE), lcd_community_language_menu); ////MSG_COMMUNITY_MADE c=18 #endif //XFLASH -#endif //COMMUNITY_LANG_SUPPORT && W52X20CL +#endif //COMMUNITY_LANGUAGE_SUPPORT && W52X20CL MENU_END(); }