aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-02-22 18:44:26 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-02-22 21:08:41 +0100
commitf5892169ee1b8da1bdf1666a36ff93a75e4b41b1 (patch)
treefbeab4c006aa4992f247b5cfd2c4c48d3aa11996 /module/vcomponent
parentFix modularization of recurrence display. (diff)
downloadcalp-f5892169ee1b8da1bdf1666a36ff93a75e4b41b1.tar.gz
calp-f5892169ee1b8da1bdf1666a36ff93a75e4b41b1.tar.xz
Fix translation for (vcomponent datetime output).
Diffstat (limited to 'module/vcomponent')
-rw-r--r--module/vcomponent/datetime/output.scm40
1 files changed, 25 insertions, 15 deletions
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")))]))