UbhiTS / ad-alexatalkingclock

Alexa (or other Smart Speakers) tell you the time without asking every hour. Please ⭐️if you like my app :)
https://www.youtube.com/c/ubhits
Apache License 2.0
38 stars 6 forks source link

Multi Language Support #9

Closed UbhiTS closed 4 years ago

UbhiTS commented 4 years ago

Hi and thanks, I use this from months and is very nice. Just a question: would it be easy to accomodate for different languages? I just inserted the italian phrases into the file, and works, but a more universal approach would be nice. E.g.

if hour == self.start_hour and minute == self.start_minute and hour <= 11:
  prefix = "Buongiorno."
elif hour == 12 and minute == 0:
  prefix = "Buom pomeriggio."
elif hour == 17 and minute == 0:
  prefix = "Buonasera."
elif hour == self.end_hour and minute == self.end_minute and hour >= 20:
  postfix = "Buonanotte. E dolci sogni."

hour = hour - 12 if hour > 12 else hour

if minute == 0:
  time_speech = f"Sono le {hour} {ampm_str}."
else:
  time_speech = f"Sono le {hour}:{minute:02d} {ampm_str}."

return prefix + " " + time_speech + " " + postfix

Originally posted by @ik0adr in https://github.com/UbhiTS/ad-alexatalkingclock/issues/7#issuecomment-619437550

UbhiTS commented 4 years ago

Can you please test v3. I've added the ability to define the time alerts (and user defined reminders) in your local language.