aboutsummaryrefslogtreecommitdiff
path: root/module/calp/terminal.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/calp/terminal.scm')
-rw-r--r--module/calp/terminal.scm55
1 files changed, 35 insertions, 20 deletions
diff --git a/module/calp/terminal.scm b/module/calp/terminal.scm
index c83e76ce..d91dc584 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)
@@ -74,7 +75,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
@@ -125,7 +126,8 @@
(cls)
- (display "== Day View ==\n")
+ (display (_ "== Day View =="))
+ (newline)
(display-calendar-header! (current-page this))
@@ -138,22 +140,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)))))))
@@ -194,14 +209,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))))
@@ -247,7 +262,7 @@
(cls)
- (display "== Search View ==\n")
+ (display (_ "== Search View ==\n"))
;; display search term
(format #t "~y" (search-term this))
@@ -303,7 +318,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))))