Per fare delle prove ho estratto il codice della localizzazione e l'ho messo in uno sketch autonomo, che stampa sulla seriale tutte le stringhe nei due linguaggi:
#include <EEPROM.h>
byte _lang;
// list of defined languages
enum {
LANG_FIRST = 0,
LANG_EN = 0,
LANG_IT = 1,
LANG_LAST = 1,
};
// eeprom memory address of language setting
const byte EE_LANG_ADDR = 128;
// number of defined languages
const byte NUM_LANGS = LANG_LAST + 1;
// max size of localized string (including null-terminator)
//const byte MAX_STR_LEN = 17
// localized strings
const char* strings[][NUM_LANGS] = {
// 0123456789012345 0123456789012345
"SetDefault_ALARM", "Allarmi_predef. ", // 0
"Patient_" , "Paziente" , // 1
"Medicine______" , "Medicina______" , // 2
"____NO_ALARM____", "_NESSUN_ALLARME_", // 3
"SET_hours_______", "Impostazione_ore", // 4
"SET_minutes_____", "Impostaz._minuti", // 5
"SET_day_________", "Impostaz._giorno", // 6
"SET_month_______", "Impostaz.___mese", // 7
"SET_year________", "Impostaz.___anno", // 8
"SET_ADJ_sec_time", "Regol.sec.giorno", // 9
"SET_Legal___time", "Attiv.ora_legale", // 10
"SET_Lang.__EN/IT", "Linguaggio_EN/IT", // 11
"SET_Sound.Pat._1", "Suoneria_Paz.__1", // 12
"SET_Sound.Pat._2", "Suoneria_Paz.__2", // 13
" Time:" , " Ore:" , // 14
"Pat.:" , "Paz.:" , // 15
"SET_hour____AL" , "SET_ore_____AL" , // 16
"SET_min.____AL" , "SET_minuti__AL" , // 17
"SET_Patient_AL" , "SET_Pazient_AL" , // 18
"SET_Medicin_AL" , "SET_Medicin_AL" , // 19
};
// localized strings identifiers
enum {
STR_FIRST = 0,
STR_SET_DEFAULT_ALARM = 0,
STR_PATIENT = 1,
STR_MEDICINE = 2,
STR_NO_ALARM = 3,
STR_SET_HOURS = 4,
STR_SET_MINUTES = 5,
STR_SET_DAY = 6,
STR_SET_MONTH = 7,
STR_SET_YEAR = 8,
STR_ADJ_SEC = 9,
STR_SET_LEGAL_TIME = 10,
STR_SET_LANG = 11,
STR_SET_SOUND_PAT_1 = 12,
STR_SET_SOUND_PAT_2 = 13,
STR_TIME = 14,
STR_PAT = 15,
STR_SET_HOUR_AL = 16,
STR_SET_MIN_AL = 17,
STR_SET_PATIENT_AL = 18,
STR_SET_MEDICINE_AL = 19,
STR_LAST = 19
};
// the the localized version of the specified string
const char* getString(byte stringId) {
return strings[stringId][_lang];
}
// select language; the selection is stored in eeprom
void setCurrLang(byte langId) {
if (langId < NUM_LANGS) {
_lang = langId;
EEPROM.write(EE_LANG_ADDR, _lang);
}
}
// get current language selection
byte getCurrLang() {
return _lang;
}
void dumpStrings() {
char buf[20];
byte saveLang;
saveLang = _lang;
for (byte strIdx = STR_FIRST; strIdx <= STR_LAST; strIdx++) {
for (_lang = LANG_FIRST; _lang <= LANG_LAST; _lang++) {
sprintf(buf, "%-16s ", getString(strIdx));
Serial.print(buf);
}
Serial.println();
}
_lang=saveLang;
}
void setup() {
Serial.begin(115200);
delay(2000);
dumpStrings();
}
void loop() {
}