🌐 Tweak language selection

This commit is contained in:
Scott Lahteine 2021-08-29 20:52:48 -05:00 committed by Scott Lahteine
parent 37777a78bf
commit c2796fbf3b
2 changed files with 18 additions and 17 deletions

View File

@ -36,9 +36,8 @@ typedef const char Language_Str[];
#define NUM_LANGUAGES 1 #define NUM_LANGUAGES 1
#endif #endif
// Setting the unused languages equal to each other allows // Set unused languages equal to each other so the
// the compiler to optimize away the conditionals // compiler can optimize away the conditionals.
#ifndef LCD_LANGUAGE_2 #ifndef LCD_LANGUAGE_2
#define LCD_LANGUAGE_2 LCD_LANGUAGE #define LCD_LANGUAGE_2 LCD_LANGUAGE
#endif #endif
@ -58,11 +57,11 @@ typedef const char Language_Str[];
#if NUM_LANGUAGES > 1 #if NUM_LANGUAGES > 1
#define HAS_MULTI_LANGUAGE 1 #define HAS_MULTI_LANGUAGE 1
#define GET_TEXT(MSG) ( \ #define GET_TEXT(MSG) ( \
ui.language == 0 ? GET_LANG(LCD_LANGUAGE )::MSG : \ ui.language == 4 ? GET_LANG(LCD_LANGUAGE_5)::MSG : \
ui.language == 1 ? GET_LANG(LCD_LANGUAGE_2)::MSG : \
ui.language == 2 ? GET_LANG(LCD_LANGUAGE_3)::MSG : \
ui.language == 3 ? GET_LANG(LCD_LANGUAGE_4)::MSG : \ ui.language == 3 ? GET_LANG(LCD_LANGUAGE_4)::MSG : \
GET_LANG(LCD_LANGUAGE_5)::MSG ) ui.language == 2 ? GET_LANG(LCD_LANGUAGE_3)::MSG : \
ui.language == 1 ? GET_LANG(LCD_LANGUAGE_2)::MSG : \
GET_LANG(LCD_LANGUAGE )::MSG )
#define MAX_LANG_CHARSIZE _MAX(GET_LANG(LCD_LANGUAGE )::CHARSIZE, \ #define MAX_LANG_CHARSIZE _MAX(GET_LANG(LCD_LANGUAGE )::CHARSIZE, \
GET_LANG(LCD_LANGUAGE_2)::CHARSIZE, \ GET_LANG(LCD_LANGUAGE_2)::CHARSIZE, \
GET_LANG(LCD_LANGUAGE_3)::CHARSIZE, \ GET_LANG(LCD_LANGUAGE_3)::CHARSIZE, \

View File

@ -41,6 +41,8 @@
#endif #endif
#undef en #undef en
#define MEDIA_TYPE_EN "Media"
namespace Language_en { namespace Language_en {
constexpr uint8_t CHARSIZE = 2; constexpr uint8_t CHARSIZE = 2;
PROGMEM Language_Str LANGUAGE = _UxGT("English"); PROGMEM Language_Str LANGUAGE = _UxGT("English");
@ -51,11 +53,11 @@ namespace Language_en {
PROGMEM Language_Str MSG_NO = _UxGT("NO"); PROGMEM Language_Str MSG_NO = _UxGT("NO");
PROGMEM Language_Str MSG_BACK = _UxGT("Back"); PROGMEM Language_Str MSG_BACK = _UxGT("Back");
PROGMEM Language_Str MSG_MEDIA_ABORTING = _UxGT("Aborting..."); PROGMEM Language_Str MSG_MEDIA_ABORTING = _UxGT("Aborting...");
PROGMEM Language_Str MSG_MEDIA_INSERTED = _UxGT("Media Inserted"); PROGMEM Language_Str MSG_MEDIA_INSERTED = MEDIA_TYPE_EN _UxGT(" Inserted");
PROGMEM Language_Str MSG_MEDIA_REMOVED = _UxGT("Media Removed"); PROGMEM Language_Str MSG_MEDIA_REMOVED = MEDIA_TYPE_EN _UxGT(" Removed");
PROGMEM Language_Str MSG_MEDIA_WAITING = _UxGT("Waiting for media"); PROGMEM Language_Str MSG_MEDIA_WAITING = _UxGT("Waiting for card");
PROGMEM Language_Str MSG_SD_INIT_FAIL = _UxGT("SD Init Fail"); PROGMEM Language_Str MSG_SD_INIT_FAIL = _UxGT("SD Init Fail");
PROGMEM Language_Str MSG_MEDIA_READ_ERROR = _UxGT("Media read error"); PROGMEM Language_Str MSG_MEDIA_READ_ERROR = MEDIA_TYPE_EN _UxGT(" read error");
PROGMEM Language_Str MSG_MEDIA_USB_REMOVED = _UxGT("USB device removed"); PROGMEM Language_Str MSG_MEDIA_USB_REMOVED = _UxGT("USB device removed");
PROGMEM Language_Str MSG_MEDIA_USB_FAILED = _UxGT("USB start failed"); PROGMEM Language_Str MSG_MEDIA_USB_FAILED = _UxGT("USB start failed");
PROGMEM Language_Str MSG_KILL_SUBCALL_OVERFLOW = _UxGT("Subcall Overflow"); PROGMEM Language_Str MSG_KILL_SUBCALL_OVERFLOW = _UxGT("Subcall Overflow");
@ -399,7 +401,7 @@ namespace Language_en {
PROGMEM Language_Str MSG_ERR_EEPROM_INDEX = _UxGT("EEPROM Index Error"); PROGMEM Language_Str MSG_ERR_EEPROM_INDEX = _UxGT("EEPROM Index Error");
PROGMEM Language_Str MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM Version Error"); PROGMEM Language_Str MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM Version Error");
PROGMEM Language_Str MSG_SETTINGS_STORED = _UxGT("Settings Stored"); PROGMEM Language_Str MSG_SETTINGS_STORED = _UxGT("Settings Stored");
PROGMEM Language_Str MSG_MEDIA_UPDATE = _UxGT("Media Update"); PROGMEM Language_Str MSG_MEDIA_UPDATE = MEDIA_TYPE_EN _UxGT(" Update");
PROGMEM Language_Str MSG_RESET_PRINTER = _UxGT("Reset Printer"); PROGMEM Language_Str MSG_RESET_PRINTER = _UxGT("Reset Printer");
PROGMEM Language_Str MSG_REFRESH = LCD_STR_REFRESH _UxGT("Refresh"); PROGMEM Language_Str MSG_REFRESH = LCD_STR_REFRESH _UxGT("Refresh");
PROGMEM Language_Str MSG_INFO_SCREEN = _UxGT("Info Screen"); PROGMEM Language_Str MSG_INFO_SCREEN = _UxGT("Info Screen");
@ -431,8 +433,8 @@ namespace Language_en {
PROGMEM Language_Str MSG_CANCEL_OBJECT = _UxGT("Cancel Object"); PROGMEM Language_Str MSG_CANCEL_OBJECT = _UxGT("Cancel Object");
PROGMEM Language_Str MSG_CANCEL_OBJECT_N = _UxGT("Cancel Object ="); PROGMEM Language_Str MSG_CANCEL_OBJECT_N = _UxGT("Cancel Object =");
PROGMEM Language_Str MSG_OUTAGE_RECOVERY = _UxGT("Power Outage"); PROGMEM Language_Str MSG_OUTAGE_RECOVERY = _UxGT("Power Outage");
PROGMEM Language_Str MSG_MEDIA_MENU = _UxGT("Print from Media"); PROGMEM Language_Str MSG_MEDIA_MENU = _UxGT("Print from ") MEDIA_TYPE_EN;
PROGMEM Language_Str MSG_NO_MEDIA = _UxGT("No Media"); PROGMEM Language_Str MSG_NO_MEDIA = _UxGT("No ") MEDIA_TYPE_EN;
PROGMEM Language_Str MSG_DWELL = _UxGT("Sleep..."); PROGMEM Language_Str MSG_DWELL = _UxGT("Sleep...");
PROGMEM Language_Str MSG_USERWAIT = _UxGT("Click to Resume..."); PROGMEM Language_Str MSG_USERWAIT = _UxGT("Click to Resume...");
PROGMEM Language_Str MSG_PRINT_PAUSED = _UxGT("Print Paused"); PROGMEM Language_Str MSG_PRINT_PAUSED = _UxGT("Print Paused");
@ -475,9 +477,9 @@ namespace Language_en {
PROGMEM Language_Str MSG_FILAMENTUNLOAD = _UxGT("Unload Filament"); PROGMEM Language_Str MSG_FILAMENTUNLOAD = _UxGT("Unload Filament");
PROGMEM Language_Str MSG_FILAMENTUNLOAD_E = _UxGT("Unload *"); PROGMEM Language_Str MSG_FILAMENTUNLOAD_E = _UxGT("Unload *");
PROGMEM Language_Str MSG_FILAMENTUNLOAD_ALL = _UxGT("Unload All"); PROGMEM Language_Str MSG_FILAMENTUNLOAD_ALL = _UxGT("Unload All");
PROGMEM Language_Str MSG_ATTACH_MEDIA = _UxGT("Attach Media"); PROGMEM Language_Str MSG_ATTACH_MEDIA = _UxGT("Attach ") MEDIA_TYPE_EN;
PROGMEM Language_Str MSG_CHANGE_MEDIA = _UxGT("Change Media"); PROGMEM Language_Str MSG_CHANGE_MEDIA = _UxGT("Change ") MEDIA_TYPE_EN;
PROGMEM Language_Str MSG_RELEASE_MEDIA = _UxGT("Release Media"); PROGMEM Language_Str MSG_RELEASE_MEDIA = _UxGT("Release ") MEDIA_TYPE_EN;
PROGMEM Language_Str MSG_ZPROBE_OUT = _UxGT("Z Probe Past Bed"); PROGMEM Language_Str MSG_ZPROBE_OUT = _UxGT("Z Probe Past Bed");
PROGMEM Language_Str MSG_SKEW_FACTOR = _UxGT("Skew Factor"); PROGMEM Language_Str MSG_SKEW_FACTOR = _UxGT("Skew Factor");
PROGMEM Language_Str MSG_BLTOUCH = _UxGT("BLTouch"); PROGMEM Language_Str MSG_BLTOUCH = _UxGT("BLTouch");