Using the new language implementation wasn't behaving as expected.

No matter what LANGUAGE_CHOICE was set to it would always take the en branch.
I revamped it a bit to use a macro to create the language include file name. This required a slight tweak to the RU declaration since it's special-cased in a couple places in code.

This is an attempt to pull my changes from #1222 over.
This commit is contained in:
Caleb Anderson 2014-12-29 10:43:19 -07:00
parent 10ad9f1062
commit e6774fb7d2
4 changed files with 32 additions and 55 deletions

View file

@ -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

View file

@ -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
// ==> ALSO TRY ALL AVAILABLE LANGUAGE OPTIONS
// Languages
// en English
@ -21,12 +25,9 @@
// 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"
@ -152,32 +153,6 @@
// 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

View file

@ -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 "Карта извлечена"

View file

@ -199,7 +199,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