From f55a28b01599692ca7a149571c6ae94e3b6b017d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 29 Aug 2021 20:52:48 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20Tweak=20language=20selection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/multi_language.h | 13 ++++++------- Marlin/src/lcd/language/language_en.h | 22 ++++++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Marlin/src/core/multi_language.h b/Marlin/src/core/multi_language.h index 1eaef69305..5063faf60c 100644 --- a/Marlin/src/core/multi_language.h +++ b/Marlin/src/core/multi_language.h @@ -36,9 +36,8 @@ typedef const char Language_Str[]; #define NUM_LANGUAGES 1 #endif -// Setting the unused languages equal to each other allows -// the compiler to optimize away the conditionals - +// Set unused languages equal to each other so the +// compiler can optimize away the conditionals. #ifndef LCD_LANGUAGE_2 #define LCD_LANGUAGE_2 LCD_LANGUAGE #endif @@ -58,11 +57,11 @@ typedef const char Language_Str[]; #if NUM_LANGUAGES > 1 #define HAS_MULTI_LANGUAGE 1 #define GET_TEXT(MSG) ( \ - ui.language == 0 ? GET_LANG(LCD_LANGUAGE )::MSG : \ - ui.language == 1 ? GET_LANG(LCD_LANGUAGE_2)::MSG : \ - ui.language == 2 ? GET_LANG(LCD_LANGUAGE_3)::MSG : \ + ui.language == 4 ? GET_LANG(LCD_LANGUAGE_5)::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, \ GET_LANG(LCD_LANGUAGE_2)::CHARSIZE, \ GET_LANG(LCD_LANGUAGE_3)::CHARSIZE, \ diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 3f1f744b55..85bf685e31 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -41,6 +41,8 @@ #endif #undef en +#define MEDIA_TYPE_EN "Media" + namespace Language_en { constexpr uint8_t CHARSIZE = 2; PROGMEM Language_Str LANGUAGE = _UxGT("English"); @@ -51,11 +53,11 @@ namespace Language_en { PROGMEM Language_Str MSG_NO = _UxGT("NO"); PROGMEM Language_Str MSG_BACK = _UxGT("Back"); PROGMEM Language_Str MSG_MEDIA_ABORTING = _UxGT("Aborting..."); - PROGMEM Language_Str MSG_MEDIA_INSERTED = _UxGT("Media Inserted"); - PROGMEM Language_Str MSG_MEDIA_REMOVED = _UxGT("Media Removed"); - PROGMEM Language_Str MSG_MEDIA_WAITING = _UxGT("Waiting for media"); + PROGMEM Language_Str MSG_MEDIA_INSERTED = MEDIA_TYPE_EN _UxGT(" Inserted"); + PROGMEM Language_Str MSG_MEDIA_REMOVED = MEDIA_TYPE_EN _UxGT(" Removed"); + 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_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_FAILED = _UxGT("USB start failed"); 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_VERSION = _UxGT("EEPROM Version Error"); 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_REFRESH = LCD_STR_REFRESH _UxGT("Refresh"); 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_N = _UxGT("Cancel Object ="); PROGMEM Language_Str MSG_OUTAGE_RECOVERY = _UxGT("Power Outage"); - PROGMEM Language_Str MSG_MEDIA_MENU = _UxGT("Print from Media"); - PROGMEM Language_Str MSG_NO_MEDIA = _UxGT("No Media"); + PROGMEM Language_Str MSG_MEDIA_MENU = _UxGT("Print from ") MEDIA_TYPE_EN; + PROGMEM Language_Str MSG_NO_MEDIA = _UxGT("No ") MEDIA_TYPE_EN; PROGMEM Language_Str MSG_DWELL = _UxGT("Sleep..."); PROGMEM Language_Str MSG_USERWAIT = _UxGT("Click to Resume..."); 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_E = _UxGT("Unload *"); PROGMEM Language_Str MSG_FILAMENTUNLOAD_ALL = _UxGT("Unload All"); - PROGMEM Language_Str MSG_ATTACH_MEDIA = _UxGT("Attach Media"); - PROGMEM Language_Str MSG_CHANGE_MEDIA = _UxGT("Change Media"); - PROGMEM Language_Str MSG_RELEASE_MEDIA = _UxGT("Release Media"); + PROGMEM Language_Str MSG_ATTACH_MEDIA = _UxGT("Attach ") MEDIA_TYPE_EN; + PROGMEM Language_Str MSG_CHANGE_MEDIA = _UxGT("Change ") MEDIA_TYPE_EN; + 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_SKEW_FACTOR = _UxGT("Skew Factor"); PROGMEM Language_Str MSG_BLTOUCH = _UxGT("BLTouch");