From 64de164e9d65a0b28b948e859d5a8aec7980e4b7 Mon Sep 17 00:00:00 2001 From: proddy Date: Wed, 6 Nov 2024 20:34:44 +0100 Subject: [PATCH] standalone includes two languages for testing, en & de --- src/common.h | 9 +++++++-- src/system.cpp | 15 ++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/common.h b/src/common.h index 696fcc644..608527620 100644 --- a/src/common.h +++ b/src/common.h @@ -52,11 +52,16 @@ using string_vector = std::vector; #define F_(string_name) (__pstr__##string_name) #define FL_(list_name) (__pstr__L_##list_name) -#if defined(EMSESP_TEST) || defined(EMSESP_EN_ONLY) -// In testing just take one language (en) to save on Flash space +#if defined(EMSESP_TEST) +// in Test mode use two languages (en & de) to save flash memory needed for the tests +#define MAKE_WORD_TRANSLATION(list_name, en, de, ...) static const char * const __pstr__L_##list_name[] = {de, nullptr}; +#define MAKE_TRANSLATION(list_name, shortname, en, de, ...) static const char * const __pstr__L_##list_name[] = {shortname, de, nullptr}; +#elif defined(EMSESP_EN_ONLY) +// EN only #define MAKE_WORD_TRANSLATION(list_name, en, ...) static const char * const __pstr__L_##list_name[] = {en, nullptr}; #define MAKE_TRANSLATION(list_name, shortname, en, ...) static const char * const __pstr__L_##list_name[] = {shortname, en, nullptr}; #elif defined(EMSESP_DE_ONLY) +// EN + DE #define MAKE_WORD_TRANSLATION(list_name, en, de, ...) static const char * const __pstr__L_##list_name[] = {de, nullptr}; #define MAKE_TRANSLATION(list_name, shortname, en, de, ...) static const char * const __pstr__L_##list_name[] = {shortname, de, nullptr}; #else diff --git a/src/system.cpp b/src/system.cpp index 7738caf43..fdc19ad6a 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -52,12 +52,17 @@ namespace emsesp { -// Languages supported. Note: the order is important and must match locale_translations.h -#if defined(EMSESP_TEST) || defined(EMSESP_EN_ONLY) -// in Debug mode use one language (en) to save flash memory needed for the tests +// Languages supported. Note: the order is important +// and must match locale_translations.h and common.h +#if defined(EMSESP_TEST) +// in Test mode use two languages (en & de) to save flash memory needed for the tests +const char * const languages[] = {EMSESP_LOCALE_EN, EMSESP_LOCALE_DE}; +#elif defined(EMSESP_EN_ONLY) +// EN only const char * const languages[] = {EMSESP_LOCALE_EN}; #elif defined(EMSESP_DE_ONLY) -const char * const languages[] = {EMSESP_LOCALE_DE}; +// EN + DE +const char * const languages[] = {EMSESP_LOCALE_EN, EMSESP_LOCALE_DE}; #else const char * const languages[] = {EMSESP_LOCALE_EN, EMSESP_LOCALE_DE, @@ -92,7 +97,7 @@ uint8_t System::language_index() { return i; } } - return 0; // EN + return 0; // EN only } // send raw to ems