Browse Source

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

3d-gussner 3 years ago
parent
commit
e02dd42765
4 changed files with 24 additions and 21 deletions
  1. 7 4
      Firmware/config.h
  2. 7 7
      Firmware/language.c
  3. 6 6
      Firmware/language.h
  4. 4 4
      Firmware/ultralcd.cpp

+ 7 - 4
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"

+ 7 - 7
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("??");
 }

+ 6 - 6
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)

+ 4 - 4
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();
 }