Qrome / marquee-scroller

Marquee Scroller Clock News Weather and More
https://www.thingiverse.com/thing:2867294
MIT License
330 stars 158 forks source link

Correct letters in German Weather Translation #193

Closed McDin closed 3 years ago

McDin commented 3 years ago

Hi again,

With following line I get the right weather in German: String apiGetData = "GET /data/2.5/group?id=" + myCityIDs + "&units=" + units + "&lang=de" + "&cnt=1&APPID=" + myApiKey + " HTTP/1.1";

But because of the font I get displayed wrong letters, for example for "Bewölkt". I see that you have included a fix for the news and tried to make same for weather but I can't get it to work.

I've done the following:

  1. In OpenWeatherMapClient.cpp I added the following at the end of the code: String OpenWeatherMapClient::cleanText(String text) { text.replace("ö", "oe"); return text; }
  2. In OpenWeatherMapClient.sh I added: String cleanText(String text); between String getWeekDay(int index, float offset); and int getTimeZone(int index);
  3. In OpenWeatherMapClient.cpp before this line Serial.println("condition: " + weathers[inx].condition); I set weathers[inx].condition = cleanText(weathers[inx].condition);

What I'm doing wrong? Also I wanted to change Friday to Freitag. I changed it in line 319 of the CPP but nothing changes. It's still "Friday".

Can you help me?

McDin commented 3 years ago

Sorry it works 👍 only thing is to change the weekday does not change when text in the openweather cpp.

McDin commented 3 years ago

I got it working, too :) I was confused about the weekdays there but info comes from the TimeDB :) But last thing I'm in trouble with is to change the format of the date in Weekday Date Month.

I See this in line 391 of marquee: if (SHOW_DATE) { msg += TimeDB.getDayName() + ", "; msg += TimeDB.getMonthName() + " " + day() + " "; }

But if I change it in: if (SHOW_DATE) { msg += TimeDB.getDayName() + ", "; msg += day() + ". " + TimeDB.getMonthName(); }

I get confusing output.

victor7376 commented 3 years ago

This may help you for putting week name, day then month:

if (SHOW_DATE) { msg += TimeDB.getDayName() + ", " + day(); // Sort out the dates if you can. if (day() == 1 || day() == 21 || day() == 31) { msg += "st, "; } else if (day() == 2 || day() == 22) { msg += "nd, "; } else if (day() == 3 || day() == 23) { msg += "rd, "; } else { msg += "th, "; }

      msg += TimeDB.getMonthName() + ", " + year() +" :"; 
McDin commented 3 years ago

Thanks this works for me: if (SHOW_DATE) { msg += TimeDB.getDayName() + ", " + day() + ". "; msg += TimeDB.getMonthName(); }

But why it does not work with my old code? Is it not possible to first massage the day and then get month ?

victor7376 commented 3 years ago

BTW if you want to code the weekdays and months in german that is coded within the TimeDB.cpp right down at the bottom.