From ff888db4188d0993f79570ba0fa1d27fa3536642 Mon Sep 17 00:00:00 2001 From: Mohsen Date: Thu, 27 Jul 2023 00:23:44 +0300 Subject: [PATCH] [#16377] fix: improve month translation --- .../calendar/calendar_month/utils.cljs | 18 ++++++++++++++- src/utils/datetime.cljs | 16 ------------- translations/en.json | 23 ++++++++++--------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/quo2/components/calendar/calendar_month/utils.cljs b/src/quo2/components/calendar/calendar_month/utils.cljs index da6cf9742ea..15a8fce49da 100644 --- a/src/quo2/components/calendar/calendar_month/utils.cljs +++ b/src/quo2/components/calendar/calendar_month/utils.cljs @@ -2,13 +2,29 @@ (:require [utils.i18n :as i18n] [utils.datetime :as dt])) +(def ^:const months-with-year + "Maps the corresponding string representation of a month + By it's numeric index as in cljs-time" + {1 "january-year" + 2 "february-year" + 3 "march-year" + 4 "april-year" + 5 "may-year" + 6 "june-year" + 7 "july-year" + 8 "august-year" + 9 "september-year" + 10 "october-year" + 11 "november-year" + 12 "december-year"}) + (defn format-month-year [year month] (let [month (cond (or (nil? month) (zero? month)) 1 (> month 12) 12 :else month)] - (str (i18n/label (get dt/full-months month)) " " year))) + (str (i18n/label (get months-with-year month) {:year year})))) (defn next-month [year month] diff --git a/src/utils/datetime.cljs b/src/utils/datetime.cljs index 8132214dccd..843172dbaf4 100644 --- a/src/utils/datetime.cljs +++ b/src/utils/datetime.cljs @@ -38,22 +38,6 @@ 11 "nov" 12 "dec"}) -(def ^:const full-months - "Maps the corresponding string representation of a month - By it's numeric index as in cljs-time" - {1 "january" - 2 "february" - 3 "march" - 4 "april" - 5 "may" - 6 "june" - 7 "july" - 8 "august" - 9 "september" - 10 "october" - 11 "november" - 12 "december"}) - (def one-second 1000) (def minute (* 60 one-second)) (defn minutes [m] (* m minute)) diff --git a/translations/en.json b/translations/en.json index 71fc85230e0..66cf8e203cd 100644 --- a/translations/en.json +++ b/translations/en.json @@ -2228,17 +2228,18 @@ "fr": "Fr", "sa": "Sa", "su": "Su", - "january": "January", - "february": "February", - "march": "March", - "april": "April", - "june": "June", - "july": "July", - "august": "August", - "september": "September", - "october": "October", - "november": "November", - "december": "December", + "january-year": "January {{year}}", + "february-year": "February {{year}}", + "march-year": "March {{year}}", + "april-year": "April {{year}}", + "may-year": "May {{year}}", + "june-year": "June {{year}}", + "july-year": "July {{year}}", + "august-year": "August {{year}}", + "september-year": "September {{year}}", + "october-year": "October {{year}}", + "november-year": "November {{year}}", + "december-year": "December {{year}}", "mon": "Mon", "tue": "Tue", "wed": "Wed",