Skip to content

Commit

Permalink
🌐 Tweak language selection
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 3, 2021
1 parent 37777a7 commit c2796fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
13 changes: 6 additions & 7 deletions Marlin/src/core/multi_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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, \
Expand Down
22 changes: 12 additions & 10 deletions Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit c2796fb

Please sign in to comment.