From 976d75952f01cc44c79cd0141d6ae5b270b0708b Mon Sep 17 00:00:00 2001 From: Maciej Janicki Date: Tue, 19 Jan 2021 13:57:49 +0100 Subject: [PATCH] [EGD-5250] Change time format on home screen and status bar This commit changes time format displayed on home screen and on status bar by adding new locale for 12H format, which excludes am/pm suffix. The new locale is set as new default format for time string. Minor: Grammar typo fixed. --- image/assets/lang/Deutsch.json | 1 + image/assets/lang/English.json | 1 + image/assets/lang/Espanol.json | 1 + image/assets/lang/Francais.json | 1 + image/assets/lang/Polski.json | 1 + module-apps/application-desktop/data/Style.hpp | 4 ++-- module-apps/application-desktop/windows/DesktopMainWindow.cpp | 4 ++-- module-utils/time/time_conversion.cpp | 2 +- module-utils/time/time_locale.hpp | 4 +++- 9 files changed, 13 insertions(+), 6 deletions(-) diff --git a/image/assets/lang/Deutsch.json b/image/assets/lang/Deutsch.json index ea8c4e53f7e661daf9f6c8a168d58a9cec13370e..fe36bdc28e72eebc588793e04b4a86f90cd8328b 100644 --- a/image/assets/lang/Deutsch.json +++ b/image/assets/lang/Deutsch.json @@ -38,6 +38,7 @@ "common_yesterday": "Yesterday", "common_today": "Today", "locale_12hour_min": "%I:%M %p", + "locale_12hour_min_short": "%I:%M", "locale_24hour_min": "%H:%M", "locale_date_full": "%m/%d/%y", "locale_date_short": "%d/%m", diff --git a/image/assets/lang/English.json b/image/assets/lang/English.json index eeb68661074112dce3efaf5e31e62006f74d325d..53a54c7a3bc4ef36ed014f059461fb4104606b48 100644 --- a/image/assets/lang/English.json +++ b/image/assets/lang/English.json @@ -62,6 +62,7 @@ "common_search": "SEARCH", "common_empty_list": "Default Info: No elements on list.", "locale_12hour_min": "%I:%M %p", + "locale_12hour_min_short": "%I:%M", "locale_24hour_min": "%H:%M", "locale_date_full": "%m/%d/%y", "locale_date_short": "%d/%m", diff --git a/image/assets/lang/Espanol.json b/image/assets/lang/Espanol.json index 2e12025935d4431567f85cb33b7298347a3a5112..f6b058f87f13288d449afea5fdf7af00d08cd06f 100644 --- a/image/assets/lang/Espanol.json +++ b/image/assets/lang/Espanol.json @@ -38,6 +38,7 @@ "common_yesterday": "Yesterday", "common_today": "Today", "locale_12hour_min": "%I:%M %p", + "locale_12hour_min_short": "%I:%M", "locale_24hour_min": "%H:%M", "locale_date_full": "%m/%d/%y", "locale_date_short": "%d/%m", diff --git a/image/assets/lang/Francais.json b/image/assets/lang/Francais.json index ea8c4e53f7e661daf9f6c8a168d58a9cec13370e..fe36bdc28e72eebc588793e04b4a86f90cd8328b 100644 --- a/image/assets/lang/Francais.json +++ b/image/assets/lang/Francais.json @@ -38,6 +38,7 @@ "common_yesterday": "Yesterday", "common_today": "Today", "locale_12hour_min": "%I:%M %p", + "locale_12hour_min_short": "%I:%M", "locale_24hour_min": "%H:%M", "locale_date_full": "%m/%d/%y", "locale_date_short": "%d/%m", diff --git a/image/assets/lang/Polski.json b/image/assets/lang/Polski.json index d0bf4bdde0a3f182f4a8b5fae92f0c216a297e0f..73c3eded6bd07014e6174169fcb0948f25468f9f 100644 --- a/image/assets/lang/Polski.json +++ b/image/assets/lang/Polski.json @@ -38,6 +38,7 @@ "common_yesterday": "wczoraj", "common_today": "dzisiaj", "locale_12hour_min": "%I:%M", + "locale_12hour_min_short": "%I:%M", "locale_24hour_min": "%H:%M", "locale_date_full": "%d.%m.%y", "locale_date_short": "%d.%m", diff --git a/module-apps/application-desktop/data/Style.hpp b/module-apps/application-desktop/data/Style.hpp index fee45f2ae4eb5437a41f9faa42d73a6c8d0aa89a..5f37948f6d4efcb7e1dabd3aaa8c45ee4853a1cb 100644 --- a/module-apps/application-desktop/data/Style.hpp +++ b/module-apps/application-desktop/data/Style.hpp @@ -24,7 +24,7 @@ namespace style::desktop constexpr auto X = 0; constexpr auto Y = 106; constexpr auto Width = style::window_width; - constexpr auto Hight = 96; + constexpr auto Height = 96; } // namespace timeLabel @@ -33,7 +33,7 @@ namespace style::desktop constexpr auto X = 0; constexpr auto Y = 204; constexpr auto Width = style::window_width; - constexpr auto Hight = 51; + constexpr auto Height = 51; } // namespace dayLabel diff --git a/module-apps/application-desktop/windows/DesktopMainWindow.cpp b/module-apps/application-desktop/windows/DesktopMainWindow.cpp index d62906390998bf6675c7607490f6d04c220c3e7b..adc33398a6fe1f0d6fbd198c8d6110a2f407028c 100644 --- a/module-apps/application-desktop/windows/DesktopMainWindow.cpp +++ b/module-apps/application-desktop/windows/DesktopMainWindow.cpp @@ -40,14 +40,14 @@ namespace gui using namespace style::desktop; - time = new gui::Label(this, timeLabel::X, timeLabel::Y, timeLabel::Width, timeLabel::Hight); + time = new gui::Label(this, timeLabel::X, timeLabel::Y, timeLabel::Width, timeLabel::Height); time->setFilled(false); time->setBorderColor(gui::ColorNoColor); time->setFont(style::window::font::supersizemelight); time->setText(ttime); time->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Top)); - dayText = new gui::Label(this, dayLabel::X, dayLabel::Y, dayLabel::Width, dayLabel::Hight); + dayText = new gui::Label(this, dayLabel::X, dayLabel::Y, dayLabel::Width, dayLabel::Height); dayText->setFilled(false); dayText->setBorderColor(gui::ColorNoColor); dayText->setFont(style::window::font::biglight); diff --git a/module-utils/time/time_conversion.cpp b/module-utils/time/time_conversion.cpp index 8533fdcd92fa7b4c296705670cf273704a1c6a2b..8c44b4069c00ea82992433b7961b686abcefd756 100644 --- a/module-utils/time/time_conversion.cpp +++ b/module-utils/time/time_conversion.cpp @@ -277,7 +277,7 @@ namespace utils::time } else { return Timestamp::str( - Locale::format(Locale::FormatTime12H)); // @TODO: M.G. FormatLocaleTime which actually works + Locale::format(Locale::FormatTime12HShort)); // @TODO: M.G. FormatLocaleTime which actually works } } diff --git a/module-utils/time/time_locale.hpp b/module-utils/time/time_locale.hpp index 29b0a6e374044ae64b42c32d97aa5a91ee0b29be..1667063c3f0ae745730f702f356db5fb489c4f38 100644 --- a/module-utils/time/time_locale.hpp +++ b/module-utils/time/time_locale.hpp @@ -21,7 +21,7 @@ namespace utils { static const int num_days = 7; static const int num_monts = 12; - static const int num_formatters = 4; + static const int num_formatters = 5; // imo it would be nicer to have datetime locales in different json with thiny bit nicer and more effective // getters const std::array daysShort = { @@ -50,6 +50,7 @@ namespace utils const std::array time_formats{ "locale_12hour_min", + "locale_12hour_min_short", "locale_24hour_min", "locale_date_full", "locale_date_short", @@ -90,6 +91,7 @@ namespace utils enum TimeFormat { FormatTime12H = 0, // H:M in 12h format + FormatTime12HShort, // H:M in 12h format, am/pm excluded FormatTime24H, // H:M in 24h format FormatLocaleDateFull, // format locale specified format FormatLocaleDateShort, // format locale specified format