in EMSESP_DEBUG only use EN language to save space

This commit is contained in:
Proddy
2023-02-05 10:58:32 +01:00
parent cf53c56ac7
commit 63e734b0aa
2 changed files with 12 additions and 0 deletions

View File

@@ -46,7 +46,14 @@ using string_vector = std::vector<const char *>;
#define F_(string_name) (__pstr__##string_name) #define F_(string_name) (__pstr__##string_name)
#define FL_(list_name) (__pstr__L_##list_name) #define FL_(list_name) (__pstr__L_##list_name)
#ifdef EMSESP_DEBUG
// In debug mode just take one language (en) to save Flash space
#define MAKE_PSTR_LIST(list_name, en, ...) static const char * const __pstr__L_##list_name[] = {en, nullptr};
#else
#define MAKE_PSTR_LIST(list_name, ...) static const char * const __pstr__L_##list_name[] = {__VA_ARGS__, nullptr}; #define MAKE_PSTR_LIST(list_name, ...) static const char * const __pstr__L_##list_name[] = {__VA_ARGS__, nullptr};
#endif
#define MAKE_PSTR_ENUM(enum_name, ...) static const char * const * __pstr__L_##enum_name[] = {__VA_ARGS__, nullptr}; #define MAKE_PSTR_ENUM(enum_name, ...) static const char * const * __pstr__L_##enum_name[] = {__VA_ARGS__, nullptr};
// clang-format on // clang-format on

View File

@@ -50,7 +50,12 @@ Adafruit_NeoPixel pixels(1, 7, NEO_GRB + NEO_KHZ800);
namespace emsesp { namespace emsesp {
// Languages supported. Note: the order is important and must match locale_translations.h // Languages supported. Note: the order is important and must match locale_translations.h
#ifdef EMSESP_DEBUG
// in Debug mode use one language (en) to save flash memory needed for the tests
const char * const languages[] = {EMSESP_LOCALE_EN};
#else
const char * const languages[] = {EMSESP_LOCALE_EN, EMSESP_LOCALE_DE, EMSESP_LOCALE_NL, EMSESP_LOCALE_SV, EMSESP_LOCALE_PL, EMSESP_LOCALE_NO, EMSESP_LOCALE_FR}; const char * const languages[] = {EMSESP_LOCALE_EN, EMSESP_LOCALE_DE, EMSESP_LOCALE_NL, EMSESP_LOCALE_SV, EMSESP_LOCALE_PL, EMSESP_LOCALE_NO, EMSESP_LOCALE_FR};
#endif
static constexpr uint8_t NUM_LANGUAGES = sizeof(languages) / sizeof(const char *); static constexpr uint8_t NUM_LANGUAGES = sizeof(languages) / sizeof(const char *);