first internationalisation for German and Dutch

pull/57/head
Dennis Koot 6 years ago
parent 219209e688
commit d3538430fc

@ -151,36 +151,101 @@ namespace ezt {
//////////////////////// ////////////////////////
String monthStr(const uint8_t month) { #ifdef EZTIME_LANG_DE
switch(month) { String monthStr(const uint8_t month) {
case 1: return F("January"); switch(month) {
case 2: return F("February"); case 1: return F("Januar");
case 3: return F("March"); case 2: return F("Februar");
case 4: return F("April"); case 3: return F("März");
case 5: return F("May"); case 4: return F("April");
case 6: return F("June"); case 5: return F("Mai");
case 7: return F("July"); case 6: return F("Juni");
case 8: return F("August"); case 7: return F("Juli");
case 9: return F("September"); case 8: return F("August");
case 10: return F("October"); case 9: return F("September");
case 11: return F("November"); case 10: return F("Oktober");
case 12: return F("December"); case 11: return F("November");
case 12: return F("Dezember");
}
return "";
} }
return "";
}
String dayStr(const uint8_t day) { String dayStr(const uint8_t day) {
switch(day) { switch(day) {
case 1: return F("Sunday"); case 1: return F("Sonntag");
case 2: return F("Monday"); case 2: return F("Montag");
case 3: return F("Tuesday"); case 3: return F("Dienstag");
case 4: return F("Wednesday"); case 4: return F("Mittwoch");
case 5: return F("Thursday"); case 5: return F("Donnerstag");
case 6: return F("Friday"); case 6: return F("Freitag");
case 7: return F("Saturday"); case 7: return F("Samstag");
}
return "";
}
#elif EZTIME_LANG_NL
String monthStr(const uint8_t month) {
switch(month) {
case 1: return F("Januari");
case 2: return F("Februari");
case 3: return F("Maart");
case 4: return F("April");
case 5: return F("Mei");
case 6: return F("Juni");
case 7: return F("Juli");
case 8: return F("Augustus");
case 9: return F("September");
case 10: return F("October");
case 11: return F("November");
case 12: return F("December");
}
return "";
} }
return "";
} String dayStr(const uint8_t day) {
switch(day) {
case 1: return F("Zondag");
case 2: return F("Maandag");
case 3: return F("Dinsdag");
case 4: return F("Woensdag");
case 5: return F("Donderdag");
case 6: return F("Vrijdag");
case 7: return F("Zaterdag");
}
return "";
}
#else
String monthStr(const uint8_t month) {
switch(month) {
case 1: return F("January");
case 2: return F("February");
case 3: return F("March");
case 4: return F("April");
case 5: return F("May");
case 6: return F("June");
case 7: return F("July");
case 8: return F("August");
case 9: return F("September");
case 10: return F("October");
case 11: return F("November");
case 12: return F("December");
}
return "";
}
String dayStr(const uint8_t day) {
switch(day) {
case 1: return F("Sunday");
case 2: return F("Monday");
case 3: return F("Tuesday");
case 4: return F("Wednesday");
case 5: return F("Thursday");
case 6: return F("Friday");
case 7: return F("Saturday");
}
return "";
}
#endif
// Original time lib compatibility // Original time lib compatibility
String dayShortStr(const uint8_t day) { return dayStr(day).substring(0,3); } String dayShortStr(const uint8_t day) { return dayStr(day).substring(0,3); }
@ -1241,9 +1306,15 @@ String Timezone::dateTime(time_t t, const ezLocalOrUTC_t local_or_utc, const Str
case 'd': // Day of the month, 2 digits with leading zeros case 'd': // Day of the month, 2 digits with leading zeros
out += ezt::zeropad(tm.Day, 2); out += ezt::zeropad(tm.Day, 2);
break; break;
case 'D': // A textual representation of a day, three letters #ifdef EZTIME_TWO_LETTER_DAY
out += ezt::dayStr(tm.Wday).substring(0,3); case 'D': // A textual representation of a day, two letters
break; out += ezt::dayStr(tm.Wday).substring(0,2);
break;
#else
case 'D': // A textual representation of a day, three letters
out += ezt::dayStr(tm.Wday).substring(0,3);
break;
#endif
case 'j': // Day of the month without leading zeros case 'j': // Day of the month without leading zeros
out += String(tm.Day); out += String(tm.Day);
break; break;

Loading…
Cancel
Save