aboutsummaryrefslogtreecommitdiff
path: root/module/calp/html/vcomponent.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-02-22 11:19:19 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-02-22 21:08:41 +0100
commit093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee (patch)
treed164e37c20e562588700d86379cfda1b0ca3c596 /module/calp/html/vcomponent.scm
parentDatetime restrict imports. (diff)
downloadcalp-093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee.tar.gz
calp-093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee.tar.xz
Prepare code for translation.
Diffstat (limited to 'module/calp/html/vcomponent.scm')
-rw-r--r--module/calp/html/vcomponent.scm103
1 files changed, 60 insertions, 43 deletions
diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm
index 16f418c5..ffdd37e2 100644
--- a/module/calp/html/vcomponent.scm
+++ b/module/calp/html/vcomponent.scm
@@ -24,6 +24,7 @@
))
:use-module ((calp util config) :select (get-config))
:use-module ((base64) :select (base64encode))
+ :use-module (calp translation)
)
;; used by search view
@@ -45,10 +46,13 @@
"unknown")))))
(time ,(let ((dt (prop event 'DTSTART)))
(if (datetime? dt)
- (datetime->string dt "~Y-~m-~d ~H:~M")
- (date->string dt "~Y-~m-~d" ))))
+ ;; Compact event list date + time
+ (datetime->string dt (_ "~Y-~m-~d ~H:~M"))
+ ;; Compact event list date only
+ (date->string dt (_ "~Y-~m-~d") ))))
(a (@ (href ,(date->string (as-date (prop event 'DTSTART)) "/week/~Y-~m-~d.html")))
- "View 📅")
+ ;; Button for viewing calendar, accompanied by a calendar icon
+ ,(_ "View") " 📅")
(span ,(prop event 'SUMMARY)))))
(cons
(calendar-styles calendars)
@@ -86,6 +90,7 @@
(data-property "summary"))
,(prop ev 'SUMMARY))))
(div
+ ;; TODO localize this?
,(call-with-values (lambda () (fmt-time-span ev))
(case-lambda [(start)
`(div (time (@ (class "dtstart")
@@ -118,7 +123,7 @@
(div (@ (class "fields"))
,(when (and=> (prop ev 'LOCATION) (negate string-null?))
- `(div (b "Plats: ")
+ `(div (b ,(_ "Location: "))
(div (@ (class "location") (data-property "location"))
,(string-map (lambda (c) (if (char=? c #\,) #\newline c))
(prop ev 'LOCATION)))))
@@ -195,8 +200,10 @@
,@(format-recurrence-rule ev)))
,(when (prop ev 'LAST-MODIFIED)
- `(div (@ (class "last-modified")) "Senast ändrad "
- ,(datetime->string (prop ev 'LAST-MODIFIED) "~1 ~H:~M"))))
+ `(div (@ (class "last-modified")) ,(_ "Last modified") " "
+ ,(datetime->string (prop ev 'LAST-MODIFIED)
+ ;; Last modified datetime
+ (_ "~1 ~H:~M")))))
))))
@@ -206,7 +213,9 @@
(define-public (fmt-day day)
(let* (((date . events) day))
`(section (@ (class "text-day"))
- (header (h2 ,(let ((s (date->string date "~Y-~m-~d")))
+ (header (h2 ,(let ((s (date->string date
+ ;; Header for sidebar day
+ (_ "~Y-~m-~d"))))
`(a (@ (href "#" ,s)
(class "hidelink")) ,s))))
,@(stream->list
@@ -291,12 +300,13 @@
;; TODO possibly unused?
(define (repeat-info event)
`(div (@ (class "eventtext"))
- (h2 "Upprepningar")
+ (h2 ,(_ "Recurrences"))
(table (@ (class "recur-components"))
,@((@@ (vcomponent recurrence internal) map-fields)
(lambda (key value)
`(tr (@ (class ,key)) (th ,key)
(td
+ ;; TODO Should these date string be translated?
,(case key
((wkst) (week-day-name value))
((until) (if (date? value)
@@ -341,6 +351,7 @@
`(select (@ ,@args)
(option "-")
,@(map (lambda (x) `(option (@ (value ,(car x))) ,(cadr x)))
+ ;; TODO translate
'((MO "Monday")
(TU "Tuesday")
(WE "Wednesday")
@@ -360,7 +371,8 @@
(div (@ (class " eventtext edit-tab "))
(form (@ (class "edit-form"))
(select (@ (class "calendar-selection"))
- (option "- Choose a Calendar -")
+ ;; NOTE flytta "muffarna" utanför
+ (option ,(_ "- Choose a Calendar -"))
,@(let ((dflt (get-config 'default-calendar)))
(map (lambda (calendar)
(define name (prop calendar 'NAME))
@@ -370,7 +382,7 @@
,name))
calendars)))
(h3 (input (@ (type "text")
- (placeholder "Sammanfattning")
+ (placeholder ,(_ "Summary"))
(name "summary") (required)
(data-property "summary")
; (value ,(prop ev 'SUMMARY))
@@ -379,24 +391,24 @@
(div (@ (class "timeinput"))
,@(with-label
- "Starttid"
+ (_ "Start time")
'(date-time-input (@ (name "dtstart")
(data-property "dtstart")
)))
,@(with-label
- "Sluttid"
+ (_ "End time")
'(date-time-input (@ (name "dtend")
(data-property "dtend"))))
(div (@ (class "checkboxes"))
,@(with-label
- "Heldag?"
+ (_ "Whole day?")
`(input (@ (type "checkbox")
(name "wholeday")
)))
,@(with-label
- "Upprepande?"
+ (_ "Recurring?")
`(input (@ (type "checkbox")
(name "has_repeats")
))))
@@ -404,8 +416,8 @@
)
,@(with-label
- "Plats"
- `(input (@ (placeholder "Plats")
+ (_ "Location")
+ `(input (@ (placeholder ,(_ "Location"))
(name "location")
(type "text")
(data-property "location")
@@ -413,20 +425,20 @@
)))
,@(with-label
- "Beskrivning"
- `(textarea (@ (placeholder "Beskrivning")
+ (_ "Description")
+ `(textarea (@ (placeholder ,(_ "Description"))
(data-property "description")
(name "description"))
; ,(prop ev 'DESCRIPTION)
))
,@(with-label
- "Kategorier"
+ (_ "Categories")
`(input-list
(@ (name "categories")
(data-property "categories"))
(input (@ (type "text")
- (placeholder "Kattegori")))))
+ (placeholder (_ "Category"))))))
;; TODO This should be a "list" where any field can be edited
;; directly. Major thing holding us back currently is that
@@ -458,6 +470,7 @@
"↺")
(span (@ (class "summary")
(data-property "summary")))))
+ ;; TODO should't the time tags contain something?
(div (div (time (@ (class "dtstart")
(data-property "dtstart")
(data-fmt "~L~H:~M")
@@ -474,7 +487,7 @@
; "20:56"
))
(div (@ (class "fields"))
- (div (b "Plats: ")
+ (div (b ,("Location: "))
(div (@ (class "location")
(data-property "location"))
; "Alsättersgatan 13"
@@ -496,7 +509,7 @@
;; "varje vecka"
;; ".")
(div (@ (class "last-modified"))
- "Senast ändrad -"
+ ,(_ "Last Modified") " -"
; "2021-09-29 19:56"
))))))
@@ -504,21 +517,21 @@
`(template
(@ (id "vevent-edit-rrule"))
(div (@ (class "eventtext"))
- (h2 "Upprepningar")
+ (h2 ,(_ "Recurrences"))
(dl
- (dt "Frequency")
+ (dt ,(_ "Frequency"))
(dd (select (@ (name "freq"))
(option "-")
,@(map (lambda (x) `(option (@ (value ,x)) ,(string-titlecase (symbol->string x))))
'(SECONDLY MINUTELY HOURLY DAILY WEEKLY MONTHLY YEARLY))))
- (dt "Until")
+ (dt ,(_ "Until"))
(dd (date-time-input (@ (name "until"))))
- (dt "Conut")
+ (dt ,(_ "Conut"))
(dd (input (@ (type "number") (name "count") (min 0))))
- (dt "Interval")
+ (dt ,(_ "Interval"))
(dd (input (@ (type "number") (name "interval") ; min and max depend on FREQ
)))
@@ -532,14 +545,14 @@
(dd (input-list (@ (name ,name))
(input (@ (type "number")
(min ,min) (max ,max)))))))
- '((bysecond "By Second" 0 60)
- (byminute "By Minute" 0 59)
- (byhour "By Hour" 0 23)
- (bymonthday "By Month Day" -31 31) ; except 0
- (byyearday "By Year Day" -366 366) ; except 0
- (byweekno "By Week Number" -53 53) ; except 0
- (bymonth "By Month" 1 12)
- (bysetpos "By Set Position" -366 366) ; except 0
+ '((bysecond ,(_ "By Second") 0 60)
+ (byminute ,(_ "By Minute") 0 59)
+ (byhour ,(_ "By Hour") 0 23)
+ (bymonthday ,(_ "By Month Day") -31 31) ; except 0
+ (byyearday ,(_ "By Year Day") -366 366) ; except 0
+ (byweekno ,(_ "By Week Number") -53 53) ; except 0
+ (bymonth ,(_ "By Month") 1 12)
+ (bysetpos ,(_ "By Set Position") -366 366) ; except 0
)))
;; (dt "By Week Day")
@@ -550,7 +563,7 @@
;; ,(week-day-select '())
;; ))
- (dt "Weekstart")
+ (dt ,(_ "Weekstart"))
(dd ,(week-day-select '((name "wkst")))))))
)
@@ -565,32 +578,36 @@
(nav (@ (class "popup-control"))
(button (@ (class "close-button")
- (title "Stäng")
+ ;; Close this popup
+ (title ,(_ "Close"))
(aria-label "Close"))
"×")
(button (@ (class "maximize-button")
- (title "Fullskärm")
+ ;; Make this popup occupy the entire screen
+ (title ,(_ "Fullscreen"))
;; (aria-label "")
)
"🗖")
(button (@ (class "remove-button")
- (title "Ta Bort"))
+ ;; Remove/Trash the event this popup represent
+ ;; Think garbage can
+ (title ,(_ "Remove")))
"🗑"))
(tab-group (@ (class "window-body"))
(vevent-description
- (@ (data-label "📅") (data-title "Översikt")
+ (@ (data-label "📅") (data-title ,(_ "Overview"))
(class "vevent")))
(vevent-edit
- (@ (data-label "🖊") (data-title "Redigera")))
+ (@ (data-label "🖊") (data-title ,(_ "Edit"))))
;; (vevent-edit-rrule
;; (@ (data-label "↺") (data-title "Upprepningar")))
(vevent-changelog
- (@ (data-label "📒") (date-title "Changelog")))
+ (@ (data-label "📒") (date-title ,(_ "Changelog"))))
,@(when (debug)
'((vevent-dl
- (@ (data-label "🐸") (data-title "Debug")))))))))
+ (@ (data-label "🐸") (data-title ,(_ "Debug"))))))))))