From f5892169ee1b8da1bdf1666a36ff93a75e4b41b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 22 Feb 2022 18:44:26 +0100 Subject: Fix translation for (vcomponent datetime output). --- module/vcomponent/datetime/output.scm | 40 ++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'module/vcomponent/datetime/output.scm') diff --git a/module/vcomponent/datetime/output.scm b/module/vcomponent/datetime/output.scm index a0ab9941..72ee8eb4 100644 --- a/module/vcomponent/datetime/output.scm +++ b/module/vcomponent/datetime/output.scm @@ -6,6 +6,7 @@ :use-module (vcomponent base) :use-module (text util) :use-module (calp translation) + :use-module ((vcomponent recurrence display) :select (format-recurrence-rule)) ) (define-config summary-filter (lambda (_ a) a) @@ -17,24 +18,30 @@ ;; ev → sxml ;; TODO translation (define-public (format-recurrence-rule ev) - `(,(_ "Upprepas ") - ,((@ (vcomponent recurrence display) format-recurrence-rule) - (prop ev 'RRULE)) + ;; [FRR] + ;; Part of the sentance "Repeated [every two weeks], except on ~a, ~a & ~a" + ;; See everything tagged [FRR] + `(,(_ "Repeated ") + ,(format-recurrence-rule (prop ev 'RRULE)) ,@(awhen (prop* ev 'EXDATE) (list - (_ ", undantaget ") + ;; See [FRR] + (_ ", except on ") (add-enumeration-punctuation (map (lambda (d) + ;; TODO show year if different from current year (if (date? d) - ;; NOTE possibly show year? - (date->string d "~e ~b") + ;; [FRR] Exception date without time + (date->string d (_ "~e ~b")) ;; NOTE only show time when it's different than the start time? ;; or possibly only when FREQ is hourly or lower. (if (memv ((@ (vcomponent recurrence internal) freq) - (prop ev 'RRULE)) - '(HOURLY MINUTELY SECONDLY)) - (datetime->string d "~e ~b ~k:~M") - (datetime->string d "~e ~b")))) + (prop ev 'RRULE)) + '(HOURLY MINUTELY SECONDLY)) + ;; [FRR] Exception date with time + (datetime->string d (_ "~e ~b ~k:~M")) + ;; [FRR] Exception date without time + (datetime->string d (_ "~e ~b"))))) (map value it))))) ".")) @@ -59,9 +66,9 @@ (cond [(prop ev 'DTEND) => (lambda (e) (if (date= e (date+ s (date day: 1))) - "~Y-~m-~d" ; start = end, only return one value - (values "~Y-~m-~d" - "~Y-~m-~d")))] + (_ "~Y-~m-~d") ; start = end, only return one value + (values (_ "~Y-~m-~d") + (_ "~Y-~m-~d"))))] ;; no end value, just return start [else (date->string s)]))] [else ; guaranteed datetime @@ -69,6 +76,9 @@ (e (prop ev 'DTEND))) (if e (let ((fmt-str (if (date= (get-date s) (get-date e)) - "~H:~M" "~Y-~m-~d ~H:~M"))) + (_ "~H:~M") + ;; Note the non-breaking space + (_ "~Y-~m-~d ~H:~M")))) (values fmt-str fmt-str)) - "~Y-~m-~d ~H:~M"))])) + ;; Note the non-breaking space + (_ "~Y-~m-~d ~H:~M")))])) -- cgit v1.2.3