From 509824a92691cb8e6f2bb177deb8a994618e2bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 25 Jan 2023 23:33:23 +0100 Subject: [PATCH] Add uk time to english messages --- locales/en.yml | 4 ++-- src/bot.rs | 8 +++++++- src/main.rs | 7 ++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index af2457e..d2c6b28 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -1,4 +1,4 @@ messages: - next_appointment: "Next meeting: %{weekday}, %{date}" - appointment_today: "Next meeting is today at %{start_time}" + next_appointment: "Next meeting: %{weekday}, %{date} (%{uk_time} UK time)" + appointment_today: "Next meeting is today at %{start_time} (%{uk_time} UK time)" starting_now: "The meeting starts now" diff --git a/src/bot.rs b/src/bot.rs index ef62a28..cf7a2e1 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -169,6 +169,11 @@ pub async fn fetch_and_announce_appointment( .with_timezone(&Europe::Berlin) .format("%d.%m.%Y %H:%M"); + let uk_time_str = appointment + .start + .with_timezone(&Europe::London) + .format("%H:%M"); + let weekday = match chat_info.locale.as_str() { "de" => match appointment.start.weekday() { chrono::Weekday::Mon => "Montag", @@ -194,7 +199,8 @@ pub async fn fetch_and_announce_appointment( "messages.next_appointment", locale = &chat_info.locale, weekday = &weekday, - date = &date_str.to_string() + date = &date_str.to_string(), + uk_time = &uk_time_str.to_string() ), ) .await?; diff --git a/src/main.rs b/src/main.rs index 51b7a3a..6377784 100644 --- a/src/main.rs +++ b/src/main.rs @@ -167,7 +167,12 @@ async fn check_task(bot: &Throttle, reminder_time: NaiveTime, db: &Database text: t!( "messages.appointment_today", locale = &chat_info.locale, - start_time = &appointment.start.format("%H:%M").to_string() + start_time = &appointment.start.format("%H:%M").to_string(), + uk_time = &appointment + .start + .with_timezone(&Europe::London) + .format("%H:%M") + .to_string() ), }) }