diff options
Diffstat (limited to '')
-rw-r--r-- | module/calp/terminal.scm | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/module/calp/terminal.scm b/module/calp/terminal.scm index cd1d0c9d..e982c468 100644 --- a/module/calp/terminal.scm +++ b/module/calp/terminal.scm @@ -26,6 +26,7 @@ #:use-module (oop goops) #:use-module (oop goops describe) + #:use-module (calp translation) #:autoload (vcomponent util instance) (global-event-object) @@ -71,7 +72,7 @@ " │ " (if (prop ev 'LOCATION) "" "\x1b[1;30m") (trim-to-width - (or (prop ev 'LOCATION) "INGEN LOKAL") location-width) + (or (prop ev 'LOCATION) (_ "NO LOCATION")) location-width) STR-RESET "\n"))) events @@ -122,7 +123,7 @@ (cls) - (display "== Day View ==\n") + (display (_ "== Day View ==\n")) (display-calendar-header! (current-page this)) @@ -135,22 +136,35 @@ ;; display highlighted event (unless (null? events) (let ((ev (list-ref events (active-element this)))) - (format #t "~a~%~% ~a~%~%~a\x1b[1mStart:\x1b[m ~a \x1b[1mSlut:\x1b[m ~a~%~%~a~%" - (prop ev '-X-HNH-FILENAME) - (prop ev 'SUMMARY) - (or (and=> (prop ev 'LOCATION) - (cut string-append "\x1b[1mPlats:\x1b[m " <> "\n")) "") - ;; NOTE RFC 5545 says that DTSTART and DTEND MUST - ;; have the same type. However we believe that is - ;; another story. + (format #t "~a" (prop ev '-X-HNH-FILENAME)) + (format #t "~%~%") + (format #t " ~a" (prop ev 'SUMMARY)) + (format #t "~%~%") + (awhen (prop ev 'LOCATION) + (format #t + "\x1b[1m~a:\x1b[m ~a~%" + (_ "Location") + it)) + ;; NOTE RFC 5545 says that DTSTART and DTEND MUST + ;; have the same type. However we believe that is + ;; another story. + (format #t "\x1b[1m~a:\x1b[m ~a " + (_ "Start") (let ((start (prop ev 'DTSTART))) (if (datetime? start) - (datetime->string (prop ev 'DTSTART) "~Y-~m-~d ~H:~M:~S") - (date->string start))) - (let ((end (prop ev 'DTEND))) - (if (datetime? end) - (datetime->string (prop ev 'DTEND) "~Y-~m-~d ~H:~M:~S") - (date->string end))) + (datetime->string (prop ev 'DTSTART) + ;; Event start date-time terminal view + (_ "~Y-~m-~d ~H:~M:~S")) + (date->string start)))) + (format #t "\x1b[1m~a:\x1b[m ~a~%~%" + (_ "End") + (let ((start (prop ev 'DTSTART))) + (if (datetime? start) + (datetime->string (prop ev 'DTSTART) + ;; Event end date-time terminal view + (_ "~Y-~m-~d ~H:~M:~S")) + (date->string start)))) + (format #t "~a~%" (unlines (take-to (flow-text (or (prop ev 'DESCRIPTION) "") #:width (min 70 width)) (- height 8 5 (length events) 5))))))) @@ -191,14 +205,14 @@ (active-element this) 0)) ((#\/) (set-cursor-pos 0 (1- height)) - (let ((search-term (get-line "quick search: "))) + (let ((search-term (get-line (_ "quick search: ")))) `(push ,(search-view (format #f "(regexp-exec (make-regexp \"~a\" regexp/icase) (prop event 'SUMMARY))" search-term) (get-event-set this))))) ((#\() (set-cursor-pos 0 (1- height)) - (let ((search-term (get-line "search: "))) + (let ((search-term (get-line (_ "search: ")))) `(push ,(search-view search-term (get-event-set this))))) (else (next-method)))) @@ -244,7 +258,7 @@ (cls) - (display "== Search View ==\n") + (display (_ "== Search View ==\n")) ;; display search term (format #t "~y" (search-term this)) @@ -300,7 +314,7 @@ 'DTSTART))))) ((#\h left) (set! (current-page this) = ((lambda (old) (max 0 (1- old)))))) ((#\l right) - (display "\n loading...\n") + (format #t "~% ~a~%" (_ "loading...")) (set! (current-page this) (next-page (slot-ref this 'search-result) (current-page this)))) |