From 7db943b147228d693c3b423ae1bf5cebbda7bd5f Mon Sep 17 00:00:00 2001 From: Caleb Anderson Date: Sun, 21 Dec 2014 14:45:34 -0700 Subject: [PATCH] Language change implementation revamped. Didn't work as intended with Arduino IDE. --- Marlin/dogm_lcd_implementation.h | 2 +- Marlin/language.h | 77 +++++++------------ Marlin/language_ru.h | 2 + .../ultralcd_implementation_hitachi_HD44780.h | 2 +- 4 files changed, 30 insertions(+), 53 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 4fed3baf11..898dc19b38 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -41,7 +41,7 @@ /* Russian language not supported yet, needs custom font -#if LANGUAGE_CHOICE == ru +#ifdef LANGUAGE_RU #include "LiquidCrystalRus.h" #define LCD_CLASS LiquidCrystalRus #else diff --git a/Marlin/language.h b/Marlin/language.h index 2e54a8860c..4a0290a926 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -1,10 +1,14 @@ #ifndef LANGUAGE_H #define LANGUAGE_H +#define LANGUAGE_CONCAT(M) #M +#define GENERATE_LANGUAGE_INCLUDE(M) LANGUAGE_CONCAT(language_##M.h) + + // NOTE: IF YOU CHANGE LANGUAGE FILES OR MERGE A FILE WITH CHANGES // -// ==> ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration.h" -// ==> ALSO TRY ALL AVAILABLE "LANGUAGE_CHOICE" OPTIONS +// ==> ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration.h" +// ==> ALSO TRY ALL AVAILABLE LANGUAGE OPTIONS // Languages // en English @@ -21,37 +25,34 @@ // ca Catalan // eu Basque-Euskera -#ifndef LANGUAGE_CHOICE - #define LANGUAGE_CHOICE en // Pick your language from the list above -#endif - -#if LANGUAGE_CHOICE >= 1 - #error "Languages now uses ISO language codes instead of numbers." +#ifndef LANGUAGE_INCLUDE + // pick your language from the list above + #define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) #endif #define PROTOCOL_VERSION "1.0" #if MB(ULTIMAKER)|| MB(ULTIMAKER_OLD)|| MB(ULTIMAIN_2) - #define MACHINE_NAME "Ultimaker" - #define FIRMWARE_URL "http://firmware.ultimaker.com" + #define MACHINE_NAME "Ultimaker" + #define FIRMWARE_URL "http://firmware.ultimaker.com" #elif MB(RUMBA) - #define MACHINE_NAME "Rumba" - #define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/" + #define MACHINE_NAME "Rumba" + #define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/" #elif MB(3DRAG) - #define MACHINE_NAME "3Drag" - #define FIRMWARE_URL "http://3dprint.elettronicain.it/" + #define MACHINE_NAME "3Drag" + #define FIRMWARE_URL "http://3dprint.elettronicain.it/" #elif MB(5DPRINT) - #define MACHINE_NAME "Makibox" - #define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/" + #define MACHINE_NAME "Makibox" + #define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/" #else - #ifdef CUSTOM_MENDEL_NAME - #define MACHINE_NAME CUSTOM_MENDEL_NAME - #else - #define MACHINE_NAME "Mendel" - #endif + #ifdef CUSTOM_MENDEL_NAME + #define MACHINE_NAME CUSTOM_MENDEL_NAME + #else + #define MACHINE_NAME "Mendel" + #endif // Default firmware set to Mendel - #define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/" + #define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/" #endif @@ -136,7 +137,7 @@ #define MSG_SD_PRINTING_BYTE "SD printing byte " #define MSG_SD_NOT_PRINTING "Not SD printing" #define MSG_SD_ERR_WRITE_TO_FILE "error writing to file" -#define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir: " +#define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir: " #define MSG_STEPPER_TOO_HIGH "Steprate too high: " #define MSG_ENDSTOPS_HIT "endstops hit: " @@ -145,36 +146,10 @@ #define MSG_BABYSTEPPING_X "Babystepping X" #define MSG_BABYSTEPPING_Y "Babystepping Y" #define MSG_BABYSTEPPING_Z "Babystepping Z" -#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Error in menu structure" +#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Error in menu structure" // LCD Menu Messages -#if LANGUAGE_CHOICE == en // English - #include "language_en.h" -#elif LANGUAGE_CHOICE == pl // Polish - #include "language_pl.h" -#elif LANGUAGE_CHOICE == fr // French - #include "language_fr.h" -#elif LANGUAGE_CHOICE == de // German - #include "language_de.h" -#elif LANGUAGE_CHOICE == es // Spanish - #include "language_es.h" -#elif LANGUAGE_CHOICE == ru // Russian - #include "language_ru.h" -#elif LANGUAGE_CHOICE == it // Italian - #include "language_it.h" -#elif LANGUAGE_CHOICE == pt // Portuguese - #include "language_pt.h" -#elif LANGUAGE_CHOICE == fi // Finnish - #include "language_fi.h" -#elif LANGUAGE_CHOICE == an // Aragonese - #include "language_an.h" -#elif LANGUAGE_CHOICE == nl // Dutch - #include "language_nl.h" -#elif LANGUAGE_CHOICE == ca // Catalan - #include "language_ca.h" -#elif LANGUAGE_CHOICE == eu // Basque-Euskera - #include "language_eu.h" -#endif +#include LANGUAGE_INCLUDE #endif //__LANGUAGE_H diff --git a/Marlin/language_ru.h b/Marlin/language_ru.h index 844b3776b7..64e60fb6d0 100644 --- a/Marlin/language_ru.h +++ b/Marlin/language_ru.h @@ -8,6 +8,8 @@ #ifndef LANGUAGE_RU_H #define LANGUAGE_RU_H +#define LANGUAGE_RU + #define WELCOME_MSG MACHINE_NAME "Готов." #define MSG_SD_INSERTED "Карта вставлена" #define MSG_SD_REMOVED "Карта извлечена" diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 923e249c85..fc7c23770d 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -198,7 +198,7 @@ extern volatile uint16_t buttons; //an extended version of the last checked but #else // Standard directly connected LCD implementations - #if LANGUAGE_CHOICE == ru + #ifdef LANGUAGE_RU #include "LiquidCrystalRus.h" #define LCD_CLASS LiquidCrystalRus #else