From 093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 22 Feb 2022 11:19:19 +0100 Subject: Prepare code for translation. --- module/calp/html/view/calendar.scm | 53 ++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'module/calp/html/view/calendar.scm') 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)) -- cgit v1.2.3