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/main.scm | 118 ++++++++++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 58 deletions(-) (limited to 'module/calp/main.scm') diff --git a/module/calp/main.scm b/module/calp/main.scm index 0ae22927..ebff00fd 100644 --- a/module/calp/main.scm +++ b/module/calp/main.scm @@ -24,29 +24,31 @@ :use-module (statprof) :use-module (calp repl) + :use-module (sxml simple) :use-module ((xdg basedir) :prefix xdg-) + :use-module (calp translation) + ) (define options `((statprof (value display-style) - (description "Run the program within Guile's built in statical " - "profiler. Display style is one of " - (b "flat") " or " (b "tree") ".")) + (description ,(xml->sxml (_ "Run the program within Guile's built in statical +profiler. Display style is one of flat or tree.")))) (repl (value address) (description - "Start a Guile repl which can be connected to, defaults to the unix socket " - (i "/run/user/${UID}/calp-${PID}") ", but it can be bound to any unix or " - "TCP socket. ((@ (vcomponent util instance) global-event-object)) " - "should contain all events." - (br) - (b "Should NOT be used in production."))) + ,(xml->sxml (_ "Start a Guile repl which can be connected to, defaults to the +unix socket /run/user/${UID}/calp-${PID}, but it can be bound to any +unix or TCP socket. ((@ (vcomponent util instance) global-event-object)) should +contain all events. +
+Should NOT be used in production.
")))) (config (value #t) (description - "Path to alterantive configuration file to load instead of the default one. ")) + ,(_ "Path to alterantive configuration file to load instead of the default one."))) ;; Techical note: ;; Guile's getopt doesn't support repeating keys. Thereby the small jank, @@ -54,57 +56,54 @@ (option (single-char #\o) (value #t) (description - "Set configuration options, on the form " - (i "key") "=" (i "value") - " as if they were set in the config file. These options have " - "priority over those from the file. " - "Can " (i "not") " be given with an equal after --option." - (br) "Can be given multiple times.")) + ,(xml->sxml (_ "Set configuration options, on the form key=value +as if they were set in the config file. These options have priority over those +from the file. Can not be given with an equal after --option.
Can +be given multiple times.
")))) (version (single-char #\v) - (description "Display version, which is " ,(@ (calp) version) " btw.")) + (description ,(format #f (_ "Display version, which is ~a btw.") + (@ (calp) version)))) (update-zoneinfo) (help (single-char #\h) - (description "Print this help")) + (description ,(_ "Print this help"))) - (printconf (description "Print known configuration variables." - (br) (b "NOTE") ": " - "Only those configuration variables which are loaded " - "will be shown, more might be available")))) + (printconf (description ,(xml->sxml (_ "Print known configuration variables. +
NOTE: +Only those configuration variables which are loaded will be shown, more might be +available
")))))) (define module-help - '(*TOP* (br) - (center (b "Calp")) (br) (br) - "Usage: " (b "calp") " [ " (i flags) " ] " (i mode) " [ " (i "mode flags") " ]" (br) - - (hr) - (center (b "Modes")) (br) (br) - - (p (b "html") " reads calendar files from disk, and writes them to static HTML files.") - - (p (b "terminal") " loads the calendars, and startrs an interactive terminal interface.") - - "[UNTESTED]" (br) - (p (b "import") "s an calendar object into the database.") - - (p (b "text") " formats and justifies what it's given on standard input, " - "and writes it to standard output. Similar to this text.") - - (p (b "ical") " loads the calendar database, and imideately " - "reserializes it back into ICAL format. " - "Useful for merging calendars.") - - (p (b "benchmark") " " (i "module") (br) - "Runs the procedure 'run-benchmark' from the module (calp benchmark " (i "module") ").") - - (p (b "server") " starts an HTTP server which dynamicly loads and displays event. The " - (i "/month/{date}.html") " & " (i "/week/{date}.html") " runs the same output code as " - (b "html") ". While the " (i "/calendar/{uid}.ics") " uses the same code as " (b "ical") ".") - - (hr) (br) - (center (b "Flags")) (br))) + (xml->sxml + (string-append + "
+
" "Calp" "
+

+" (_ "Usage: calp [ flags ] mode [ mode flags ]") "
+
" +;; Header for following list of modes of operation + "
" (_ "Modes") "
+

" + (_ "

html reads calendar files from disk, and writes them to static HTML files.

") + (_ "

terminal loads the calendars, and starts an interactive terminal interface.

") + (_ "[UNTESTED]

imports a calendar object into the database.

") + (_ "

text formats and justifies what it's given on standard input, +and writes it to standard output. Similar to this text.

") + (_ "

ical loads the calendar database, and immediately +re-serializes it back into iCAL format. Useful for merging calendars.

") + (_ "

benchmark module
Runs the procedure 'run-benchmark' +from the module (calp benchmark module).

") + (_ "

server starts an HTTP server which dynamically loads and +displays events. The /month/{date}.html & /week/{date}.html runs +the same output code as html. While the /calendar/{uid}.ics uses +the same code as ical.

") + "

" + ;; Header for list of available flags. + ;; Actual list is auto generated elsewhere. + "
" (_ "Flags") "
+
"))) (define (ornull a b) (if (null? a) @@ -121,7 +120,7 @@ (if (file-exists? altconfig) altconfig (throw 'option-error - "Configuration file ~a missing" altconfig))] + (_ "Configuration file ~a missing") altconfig))] ;; altconfig could be placed in the list below. But I want to raise an error ;; if an explicitly given config is missing. [(find file-exists? @@ -166,7 +165,10 @@ )) (lambda args (format (current-error-port) - "Failed loading config file ~a~%~s~%" + ;; Two arguments: + ;; Configuration file path, + ;; thrown error arguments + (_ "Failed loading config file ~a~%~s~%") config-file args ))) @@ -207,13 +209,13 @@ (throw 'return)) (when (option-ref opts 'version #f) - (format #t "Calp version ~a~%" (@ (calp) version)) + (format #t (_ "Calp version ~a~%") (@ (calp) version)) (throw 'return)) (when (option-ref opts 'update-zoneinfo #f) (let* ((locations (list "/usr/libexec/calp/tzget" (path-append (xdg-data-home) "tzget"))) (filename (or (find file-exists? locations) - (error "tzget not installed, please put it in one of ~a" locations))) + (error (_ "tzget not installed, please put it in one of ~a") locations))) (pipe (open-input-pipe filename))) ;; (define path (read-line pipe)) @@ -245,7 +247,7 @@ ((benchmark) (@ (calp entry-points benchmark) main)) (else => (lambda (s) (format (current-error-port) - "Unsupported mode of operation: ~a~%" + (_ "Unsupported mode of operation: ~a~%") s) (exit 1)))) ropt)) @@ -260,7 +262,7 @@ (define-public (main args) - ((@ (calp util time) report-time!) "Program start") + ((@ (calp util time) report-time!) (_ "Program start")) (with-throw-handler #t (lambda () (dynamic-wind (lambda () 'noop) -- cgit v1.2.3