diff options
Diffstat (limited to 'module/calp/html/view')
-rw-r--r-- | module/calp/html/view/calendar.scm | 53 | ||||
-rw-r--r-- | module/calp/html/view/calendar/week.scm | 9 | ||||
-rw-r--r-- | module/calp/html/view/search.scm | 13 |
3 files changed, 45 insertions, 30 deletions
diff --git a/module/calp/html/view/calendar.scm b/module/calp/html/view/calendar.scm index ecdce291..c7a5c8c2 100644 --- a/module/calp/html/view/calendar.scm +++ b/module/calp/html/view/calendar.scm @@ -27,6 +27,7 @@ :use-module ((vcomponent util group) :select (group-stream get-groups-between)) :use-module ((base64) :select (base64encode)) + :use-module (calp translation) ) @@ -72,10 +73,10 @@ ,display))) (unless next-start - (error 'html-generate "Next-start needs to be a procedure")) + (error 'html-generate (_ "Next-start needs to be a procedure"))) (unless prev-start - (error 'html-generate "Prev-start needs to be a procedure")) + (error 'html-generate (_ "Prev-start needs to be a procedure"))) (xhtml-doc (@ (lang sv)) @@ -86,9 +87,11 @@ (meta (@ (name viewport) (content "width=device-width, initial-scale=0.5"))) (meta (@ (name description) - (content "Calendar for the dates between " - ,(date->string start-date) " and " - ,(date->string end-date)))) + (content ,(format #f (_ "Calendar for the dates between ~a and ~a") + ;; start date metainfo + (date->string start-date (_ "~Y-~m-~d")) + ;; end date metainfo + (date->string end-date (_ "~Y-~m-~d")))))) ;; NOTE this is only for the time actually part of this calendar. ;; overflowing times from pre-start and post-end is currently ignored here. (meta (@ (name start-time) @@ -148,10 +151,12 @@ window.default_calendar='~a';" ;; Page footer (footer (@ (style "grid-area: footer")) - (span "Page generated " ,(date->string (current-date))) - (span "Current time " (current-time (@ (interval 1)))) + (span ,(_ "Page generated ") + ;; Generation data + ,(date->string (current-date) (_ "~Y-~m-~d"))) + (span ,(_ "Current time ") (current-time (@ (interval 1)))) (span (a (@ (href ,(repo-url))) - "Source Code"))) + ,(_ "Source Code")))) ;; Small calendar and navigation (nav (@ (class "calnav") (style "grid-area: nav")) @@ -161,10 +166,12 @@ window.default_calendar='~a';" (start-of-week start-date) start-date) "/week/~1.html") - "veckovy") + ;; Button to view week + (_ "Week")) ,(btn href: (date->string (set (day start-date) 1) "/month/~1.html") - "månadsvy") + ;; button to view month + (_ "Month")) (today-button (a (@ (class "btn") @@ -173,7 +180,8 @@ window.default_calendar='~a';" [(month) "view=month"] [(week) "view=week"] [else ""])))) - "idag"))) + ;; Button to go to today + ,(_ "Today")))) (div (@ (id "jump-to")) ;; Firefox's accessability complain about each date @@ -193,9 +201,11 @@ window.default_calendar='~a';" ,(btn "➔")))) (details (@ (open) (style "grid-area: cal")) - (summary "Month overview") + (summary ,(_ "Month overview")) (div (@ (class "smallcall-head")) - ,(string-titlecase (date->string start-date "~B ~Y"))) + ,(string-titlecase (date->string start-date + ;; Header of small calendar + (_ "~B ~Y")))) ;; NOTE it might be a good idea to put the navigation buttons ;; earlier in the DOM-tree/tag order. At least Vimium's ;; @key{[[} keybind sometimes finds parts of events instead. @@ -220,17 +230,17 @@ window.default_calendar='~a';" (action "/search/text")) (input (@ (type "text") (name "q") - (placeholder "Sök"))) + ;; Search placeholder + (placeholder ,(_ "Search")))) (input (@ (type "submit") (value ">")))) ,(when (or (debug) (edit-mode)) `(details (@ (class "sliders")) - (summary "Option sliders") - + (summary ,(_ "Option sliders")) ,@(when (edit-mode) - `((label "Event blankspace") + `((label ,(_ "Event blankspace")) ,(slider-input variable: "editmode" min: 0 @@ -239,7 +249,7 @@ window.default_calendar='~a';" value: 1))) ,@(when (debug) - `((label "Fontsize") + `((label ,(_ "Fontsize")) ,(slider-input unit: "pt" min: 1 @@ -250,7 +260,7 @@ window.default_calendar='~a';" ;; List of calendars (details (@ (class "calendarlist")) - (summary "Calendar list") + (summary ,(_ "Calendar list")) (ul ,@(map (lambda (calendar) `(li (@ (data-calendar ,(base64encode (prop calendar 'NAME)))) @@ -276,7 +286,7 @@ window.default_calendar='~a';" ;; Events which started before our start point, ;; but "spill" into our time span. (section (@ (class "text-day")) - (header (h2 "Tidigare")) + (header (h2 ,(_ "Earlier"))) ;; TODO this group gets styles applied incorrectly. ;; Figure out way to merge it with the below call. ,@(stream->list @@ -284,8 +294,7 @@ window.default_calendar='~a';" (lambda (ev) (fmt-single-event ev `((id ,(html-id ev)) - (data-calendar ,(base64encode (or (prop (parent ev) 'NAME) - "unknown")))))) + (data-calendar ,(base64encode (or (prop (parent ev) 'NAME) "unknown")))))) (stream-take-while (compose (cut date/-time<? <> start-date) (extract 'DTSTART)) diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm index 5b12a351..921bdb83 100644 --- a/module/calp/html/view/calendar/week.scm +++ b/module/calp/html/view/calendar/week.scm @@ -17,6 +17,7 @@ :select (make-block output-uid) ) ;; :use-module ((calp html components) ;; :select ()) + :use-module (calp translation) :use-module ((vcomponent util group) :select (group-stream get-groups-between)) ) @@ -30,7 +31,9 @@ (div (@ (class "days")) ;; Top left area (div (@ (class "week-indicator")) - (span (@ (style "font-size: 50%")) "v.") ; figure out if we want this... + (span (@ (style "font-size: 50%")) + ;; Week number prefix + ,(_ "v.")) ,@(->> (week-number start-date) number->string string->list (map (lambda (c) `(span ,(string c)))))) @@ -43,8 +46,10 @@ ,@(map (lambda (day-date) `(div (@ (class "meta")) (span (@ (class "daydate")) - ,(date->string day-date "~Y-~m-~d")) + ;; Week view header format + ,(date->string day-date (_ "~Y-~m-~d"))) (span (@ (class "dayname")) + ;; TODO translation here? ,(string-titlecase (date->string day-date "~a"))))) range) ,@(stream->list diff --git a/module/calp/html/view/search.scm b/module/calp/html/view/search.scm index 9b03151b..08436bc5 100644 --- a/module/calp/html/view/search.scm +++ b/module/calp/html/view/search.scm @@ -8,6 +8,7 @@ :select (xhtml-doc include-css)) :use-module ((calp html vcomponent) :select (compact-event-list)) + :use-module (calp translation) ) ;; Display the result of a search term, but doesn't do any searching @@ -24,25 +25,25 @@ errors has-query? search-term search-result page paginator) (xhtml-doc (@ (lang sv)) - (head (title "Search results") + (head (title ,(_ "Search results")) ,(include-css "/static/style.css")) (body - (a (@ (href ("/today"))) "Till Idag") - (h2 "Search term") + (a (@ (href ("/today"))) ,(_ "Show today")) + (h2 ,(_ "Search term")) (form (pre (textarea (@ (name "q") (rows 5) (spellcheck false) (style "width:100%")) ,(when has-query? (with-output-to-string (lambda () (pretty-print search-term)))))) - (label (@ (for "onlyfuture")) "limit to future occurences") + (label (@ (for "onlyfuture")) ,(_ "limit to future occurences")) (input (@ (name "onlyfuture") (id "onlyfuture") (type checkbox))) (input (@ (type submit)))) ,@(if errors - `((h2 "Error searching") + `((h2 ,(_ "Error searching")) (div (@ (class "error")) (pre ,errors))) - `((h2 "Result (page " ,page ")") + `((h2 ,(format #f (_ "Result (page ~a)") page)) (ul ,@(compact-event-list search-result)) (div (@ (class "paginator")) ,@(paginator->list |