Skip to content

Commit

Permalink
Add multilingual support for DGUS Reloaded
Browse files Browse the repository at this point in the history
Add multilingual support for DGUS Reloaded + adding French language without accented characters (for DGUS Reloaded)
  • Loading branch information
albatorsssx committed Feb 27, 2023
1 parent 8c9e456 commit e8e882f
Show file tree
Hide file tree
Showing 7 changed files with 630 additions and 555 deletions.
1 change: 1 addition & 0 deletions Marlin/src/core/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
// eu Basque-Euskera
// fi Finnish
// fr French
// fr_na French without accented character for DWIN T5UID1 touchscreen compatibilities
// gl Galician
// hr Croatian
// hu Hungarian
Expand Down
68 changes: 34 additions & 34 deletions Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) {

if (vp.addr == DGUS_Addr::SCREENCHANGE_Idle
&& (ExtUI::isPrinting() || ExtUI::isPrintingPaused())) {
dgus_screen_handler.SetStatusMessage(F("Impossible while printing"));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_IMPOSSIBLE_WHILE_PRINTING));
return;
}

if (vp.addr == DGUS_Addr::SCREENCHANGE_Printing
&& (!ExtUI::isPrinting() && !ExtUI::isPrintingPaused())) {
dgus_screen_handler.SetStatusMessage(F("Impossible while idle"));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_IMPOSSIBLE_WHILE_IDLE));
return;
}

Expand Down Expand Up @@ -137,7 +137,7 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) {
UNUSED(data_ptr);

if (dgus_screen_handler.filelist_selected < 0) {
dgus_screen_handler.SetStatusMessage(F("No file selected"));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_NO_FILE_SELECTED ));
return;
}

Expand All @@ -147,7 +147,7 @@ void DGUSRxHandler::ScreenChange(DGUS_VP &vp, void *data_ptr) {
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand Down Expand Up @@ -205,7 +205,7 @@ void DGUSRxHandler::PrintResume(DGUS_VP &vp, void *data_ptr) {
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand Down Expand Up @@ -362,7 +362,7 @@ void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) {
#endif
}

dgus_screen_handler.SetStatusMessage(F("Cooling..."));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_COOLING));

dgus_screen_handler.TriggerFullUpdate();
}
Expand All @@ -388,12 +388,12 @@ void DGUSRxHandler::ZOffset(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);

if (!ExtUI::isAxisPositionKnown(ExtUI::Z)) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
return;
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand All @@ -412,12 +412,12 @@ void DGUSRxHandler::ZOffsetStep(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);

if (!ExtUI::isAxisPositionKnown(ExtUI::Z)) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
return;
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand Down Expand Up @@ -454,12 +454,12 @@ void DGUSRxHandler::MoveToPoint(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);

if (!ExtUI::isPositionKnown()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
return;
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand Down Expand Up @@ -509,12 +509,12 @@ void DGUSRxHandler::Probe(DGUS_VP &vp, void *data_ptr) {
#endif

if (!ExtUI::isPositionKnown()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
return;
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand All @@ -533,7 +533,7 @@ void DGUSRxHandler::DisableABL(DGUS_VP &vp, void *data_ptr) {
UNUSED(data_ptr);

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand Down Expand Up @@ -574,7 +574,7 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand All @@ -598,7 +598,7 @@ void DGUSRxHandler::FilamentMove(DGUS_VP &vp, void *data_ptr) {
}

if (ExtUI::getActualTemp_celsius(extruder) < (float)EXTRUDE_MINTEMP) {
dgus_screen_handler.SetStatusMessage(F("Temperature too low"));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_TEMP_TOO_LOW));
return;
}

Expand All @@ -618,14 +618,14 @@ void DGUSRxHandler::Home(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

DGUS_Data::Axis axis = (DGUS_Data::Axis)((uint8_t*)data_ptr)[1];

dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1);
dgus_screen_handler.SetMessageLinePGM(DGUS_MSG_HOMING, 2);
dgus_screen_handler.SetMessageLinePGM(GET_TEXT(DGUS_MSG_HOMING), 2);
dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3);
dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4);
dgus_screen_handler.ShowWaitScreen(dgus_screen_handler.GetCurrentScreen());
Expand Down Expand Up @@ -662,7 +662,7 @@ void DGUSRxHandler::Move(DGUS_VP &vp, void *data_ptr) {
}

if (!ExtUI::isAxisPositionKnown(axis)) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
return;
}

Expand Down Expand Up @@ -718,7 +718,7 @@ void DGUSRxHandler::MoveStep(DGUS_VP &vp, void *data_ptr) {
}

if (!ExtUI::isAxisPositionKnown(axis)) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_HOMING_REQUIRED));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_HOMING_REQUIRED));
return;
}

Expand Down Expand Up @@ -755,12 +755,12 @@ void DGUSRxHandler::GcodeExecute(DGUS_VP &vp, void *data_ptr) {
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1);
dgus_screen_handler.SetMessageLinePGM(PSTR("Executing command..."), 2);
dgus_screen_handler.SetMessageLinePGM(GET_TEXT(MSG_EXECUTING_COMMAND), 2);
dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3);
dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4);
dgus_screen_handler.ShowWaitScreen(DGUS_Screen::GCODE);
Expand All @@ -778,7 +778,7 @@ void DGUSRxHandler::ResetEEPROM(DGUS_VP &vp, void *data_ptr) {
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand All @@ -796,7 +796,7 @@ void DGUSRxHandler::SettingsExtra(DGUS_VP &vp, void *data_ptr) {
case DGUS_Data::Extra::BUTTON1:
#if ENABLED(BLTOUCH)
if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand Down Expand Up @@ -842,7 +842,7 @@ void DGUSRxHandler::PIDSetTemp(DGUS_VP &vp, void *data_ptr) {
UNUSED(vp);

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand Down Expand Up @@ -873,7 +873,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
UNUSED(data_ptr);

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand All @@ -887,15 +887,15 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
heater = H_BED;
break;
#else
dgus_screen_handler.SetStatusMessage(F("Bed PID disabled"));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_BED_PID_DISABLED));
return;
#endif
case DGUS_Data::Heater::H0:
#if ENABLED(PIDTEMP)
heater = H_E0;
break;
#else
dgus_screen_handler.SetStatusMessage(F("PID disabled"));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_PID_DISABLED));
return;
#endif
#if HAS_MULTI_HOTEND
Expand All @@ -904,7 +904,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
heater = H_E1;
break;
#else
dgus_screen_handler.SetStatusMessage(F("PID disabled"));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_PID_DISABLED));
return;
#endif
#endif
Expand All @@ -914,7 +914,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
snprintf_P(buffer, sizeof(buffer), PSTR("M303C%dE%dS%dU1"), cycles, heater, dgus_screen_handler.pid_temp);

dgus_screen_handler.SetMessageLinePGM(NUL_STR, 1);
dgus_screen_handler.SetMessageLinePGM(PSTR("PID autotuning..."), 2);
dgus_screen_handler.SetMessageLinePGM(GET_TEXT(MSG_PID_AUTOTUNING), 2);
dgus_screen_handler.SetMessageLinePGM(NUL_STR, 3);
dgus_screen_handler.SetMessageLinePGM(NUL_STR, 4);
dgus_screen_handler.ShowWaitScreen(DGUS_Screen::PID);
Expand All @@ -934,7 +934,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

Expand All @@ -953,12 +953,12 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) {
}

if (!dgus_screen_handler.IsPrinterIdle()) {
dgus_screen_handler.SetStatusMessage(FPSTR(DGUS_MSG_BUSY));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(DGUS_MSG_BUSY));
return;
}

if (!recovery.valid()) {
dgus_screen_handler.SetStatusMessage(F("Invalid recovery data"));
dgus_screen_handler.SetStatusMessage(GET_TEXT_F(MSG_INVALID_RECOVERY_DATA ));
return;
}

Expand Down
15 changes: 8 additions & 7 deletions Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bool DGUSScreenHandler::leveling_active = false;
millis_t DGUSScreenHandler::status_expire = 0;
millis_t DGUSScreenHandler::eeprom_save = 0;

const char DGUS_MSG_HOMING_REQUIRED[] PROGMEM = "Homing required",
const char DGUS_MSG_HOMING_REQUIRED[] PROGMEM = "Homing required",
DGUS_MSG_BUSY[] PROGMEM = "Busy",
DGUS_MSG_UNDEF[] PROGMEM = "-",
DGUS_MSG_HOMING[] PROGMEM = "Homing...",
Expand Down Expand Up @@ -136,9 +136,9 @@ void DGUSScreenHandler::Loop() {
}

if (current_screen == DGUS_Screen::LEVELING_PROBING && IsPrinterIdle()) {
dgus_display.PlaySound(3);
dgus_display.PlaySound(3);

SetStatusMessage(ExtUI::getMeshValid() ? F("Probing successful") : F("Probing failed"));
SetStatusMessage(ExtUI::getMeshValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED));

MoveToScreen(DGUS_Screen::LEVELING_AUTOMATIC);
return;
Expand Down Expand Up @@ -189,7 +189,7 @@ void DGUSScreenHandler::SettingsReset() {
Ready();
}

SetStatusMessage(F("EEPROM reset"));
SetStatusMessage(GET_TEXT_F(DGUS_MSG_RESET_EEPROM));
}

void DGUSScreenHandler::StoreSettings(char *buff) {
Expand Down Expand Up @@ -223,12 +223,12 @@ void DGUSScreenHandler::LoadSettings(const char *buff) {

void DGUSScreenHandler::ConfigurationStoreWritten(bool success) {
if (!success)
SetStatusMessage(F("EEPROM write failed"));
SetStatusMessage(GET_TEXT_F(DGUS_MSG_WRITE_EEPROM_FAILED));
}

void DGUSScreenHandler::ConfigurationStoreRead(bool success) {
if (!success) {
SetStatusMessage(F("EEPROM read failed"));
SetStatusMessage(GET_TEXT_F(DGUS_MSG_READ_EEPROM_FAILED));
}
else if (!settings_ready) {
settings_ready = true;
Expand Down Expand Up @@ -283,7 +283,8 @@ void DGUSScreenHandler::PrintTimerStopped() {

void DGUSScreenHandler::FilamentRunout(const ExtUI::extruder_t extruder) {
char buffer[21];
snprintf_P(buffer, sizeof(buffer), PSTR("Filament runout E%d"), extruder);

snprintf_P(buffer, sizeof(buffer), GET_TEXT(DGUS_MSG_FILAMENT_RUNOUT), extruder);

SetStatusMessage(buffer);

Expand Down
Loading

0 comments on commit e8e882f

Please sign in to comment.