From 78fd74622dca5f2def261506c3f8d4c0a940a6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 14 Oct 2022 21:08:16 +0200 Subject: Change gettext '_' to 'G_'. Guile 3 reserves _ for other stuff. --- Makefile | 2 +- module/calp/entry-points/benchmark.scm | 4 +- module/calp/entry-points/convert.scm | 14 ++--- module/calp/entry-points/html.scm | 22 +++---- module/calp/entry-points/ical.scm | 4 +- module/calp/entry-points/import.scm | 12 ++-- module/calp/entry-points/server.scm | 20 +++--- module/calp/entry-points/terminal.scm | 4 +- module/calp/entry-points/text.scm | 6 +- module/calp/entry-points/tidsrapport.scm | 18 +++--- module/calp/entry-points/update-zoneinfo.scm | 4 +- module/calp/html/caltable.scm | 2 +- module/calp/html/components.scm | 2 +- module/calp/html/util.scm | 2 +- module/calp/html/vcomponent.scm | 86 +++++++++++++------------- module/calp/html/view/calendar.scm | 40 ++++++------ module/calp/html/view/calendar/shared.scm | 2 +- module/calp/html/view/calendar/week.scm | 4 +- module/calp/html/view/search.scm | 12 ++-- module/calp/main.scm | 46 +++++++------- module/calp/repl.scm | 8 +-- module/calp/server/routes.scm | 34 +++++----- module/calp/terminal.scm | 22 +++---- module/calp/translation.scm | 4 +- module/calp/util/config.scm | 4 +- module/calp/util/exceptions.scm | 2 +- module/datetime/instance.scm | 4 +- module/datetime/timespec.scm | 2 +- module/datetime/zic.scm | 16 ++--- module/vcomponent/config.scm | 4 +- module/vcomponent/control.scm | 2 +- module/vcomponent/datetime/output.scm | 24 +++---- module/vcomponent/formats/common/types.scm | 10 +-- module/vcomponent/formats/ical/output.scm | 2 +- module/vcomponent/formats/ical/parse.scm | 15 +++-- module/vcomponent/formats/ical/types.scm | 4 +- module/vcomponent/formats/vdir/parse.scm | 2 +- module/vcomponent/formats/vdir/save-delete.scm | 10 +-- module/vcomponent/formats/xcal/output.scm | 2 +- module/vcomponent/formats/xcal/parse.scm | 4 +- module/vcomponent/formats/xcal/types.scm | 2 +- module/vcomponent/util/instance.scm | 2 +- module/vcomponent/util/instance/methods.scm | 12 ++-- module/vcomponent/util/parse-cal-path.scm | 4 +- tests/test/html/caltable.scm | 2 +- 45 files changed, 253 insertions(+), 250 deletions(-) diff --git a/Makefile b/Makefile index f8827603..aab3c17a 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ SKIP=--skip $(PWD)/tests/test/web-server.scm all: go_files static $(LOCALIZATIONS) $(MAKE) -C doc/ref -XGETTEXT_FLAGS = --from-code=UTF-8 --add-comments --indent -k_ +XGETTEXT_FLAGS = --from-code=UTF-8 --add-comments --indent -kG_ static: $(MAKE) -C static diff --git a/module/calp/entry-points/benchmark.scm b/module/calp/entry-points/benchmark.scm index 31ea958a..709d2bea 100644 --- a/module/calp/entry-points/benchmark.scm +++ b/module/calp/entry-points/benchmark.scm @@ -17,9 +17,9 @@ (define opt-spec `((enable-output (single-char #\o) (description - ,(_ "Output is by default supressed, since many fields contain way to much data to read. This turns it on again.") + ,(G_ "Output is by default supressed, since many fields contain way to much data to read. This turns it on again.") )) - (help (single-char #\h) (description ,(_ "Print this help."))))) + (help (single-char #\h) (description ,(G_ "Print this help."))))) (define (main args) diff --git a/module/calp/entry-points/convert.scm b/module/calp/entry-points/convert.scm index 707414e5..0835b3d6 100644 --- a/module/calp/entry-points/convert.scm +++ b/module/calp/entry-points/convert.scm @@ -12,12 +12,12 @@ (define opt-spec `((from (single-char #\f) (value (options "xcal" "ical")) - (description ,(xml->sxml (_ "Input format (otherwise infered from infile)")))) + (description ,(xml->sxml (G_ "Input format (otherwise infered from infile)")))) (to (single-char #\t) (value (options "xcal" "ical")) - (description ,(xml->sxml (_ "Output format (otherwise infered from outfile)")))) - (infile (value #t) (single-char #\i) (description ,(_ "Input file"))) - (outfile (value #t) (single-char #\o) (description ,(_ "Output file"))) - (help (single-char #\h) (description ,(_ "Print this help."))))) + (description ,(xml->sxml (G_ "Output format (otherwise infered from outfile)")))) + (infile (value #t) (single-char #\i) (description ,(G_ "Input file"))) + (outfile (value #t) (single-char #\o) (description ,(G_ "Output file"))) + (help (single-char #\h) (description ,(G_ "Print this help."))))) (define (filename-to-type filename) @@ -71,7 +71,7 @@ ;; TODO strip *TOP* xml->sxml)] [else (scm-error 'misc-error "convert-main" - (_ "Unexpected parser type: ~a") + (G_ "Unexpected parser type: ~a") (list from) #f)] )) @@ -90,7 +90,7 @@ component) port))] [else (scm-error 'misc-error "convert-main" - (_ "Unexpected writer type: ~a") + (G_ "Unexpected writer type: ~a") (list to) #f)])) diff --git a/module/calp/entry-points/html.scm b/module/calp/entry-points/html.scm index 2aa7e0e2..de229533 100644 --- a/module/calp/entry-points/html.scm +++ b/module/calp/entry-points/html.scm @@ -31,21 +31,21 @@ (define opt-spec `((from (value #t) (single-char #\F) - (description ,(_ "Start date of output.")) + (description ,(G_ "Start date of output.")) ) (count (value #t) - (description ,(xml->sxml (_ "How many pages should be rendered. + (description ,(xml->sxml (G_ "How many pages should be rendered. If --style=week and --from=2020-04-27; then --count=4 would render the four pages 2020-04-27, 2020-05-04, 2020-05-11, and 2020-05-25. Defaults to 12 to give a whole year when --style=month")))) (target (single-char #\t) (value #t) - (description ,(xml->sxml (_ "Directory where html files should end up. Default to ./html")))) + (description ,(xml->sxml (G_ "Directory where html files should end up. Default to ./html")))) (style (value #t) (predicate ,(lambda (v) (memv (string->symbol v) '(small wide week table)))) - (description ,(xml->sxml (_ "How the body of the HTML page should be layed out. + (description ,(xml->sxml (G_ "How the body of the HTML page should be layed out.
week gives a horizontally scrolling page with 7 elements, where each has events graphically laid out hour by hour. @@ -56,10 +56,10 @@ given day, in order of start time. They are however not graphically sized. is the same as week, but gives a full month.
")))) (standalone - (description ,(xml->sxml (_ "Creates a standalone document instead of an HTML fragment + (description ,(xml->sxml (G_ "Creates a standalone document instead of an HTML fragment for embedding in a larger page. Currently only applies to the small style")))) - (help (single-char #\h) (description ,(_ "Print this help."))))) + (help (single-char #\h) (description ,(G_ "Print this help."))))) @@ -81,9 +81,9 @@ for embedding in a larger page. Currently only applies to the small style ((= errno EEXIST) (let ((st (lstat link))) (cond ((not (eq? 'symlink (stat:type st))) - (warning (_ "File ~s exists, but isn't a symlink") link)) + (warning (G_ "File ~s exists, but isn't a symlink") link)) ((not (string=? target (readlink link))) - (warning (_ "~s is a symlink, but points to ~s instead of expected ~s") + (warning (G_ "~s is a symlink, but points to ~s instead of expected ~s") link (readlink link) target)))) ;; else, file exists as a symlink, and points where we want, ;; which is expected. Do nothing and be happy. @@ -113,7 +113,7 @@ for embedding in a larger page. Currently only applies to the small style (stream-for-each (lambda (start-date) (define fname (path-append target-directory (date->string start-date "~1.xml"))) - (format (current-error-port) (_ "Writing to [~a]~%") fname) + (format (current-error-port) (G_ "Writing to [~a]~%") fname) (with-output-to-file fname (lambda () (sxml->xml (re-root-static (apply html-generate @@ -178,7 +178,7 @@ for embedding in a larger page. Currently only applies to the small style pre-start: (start-of-week start) post-end: (end-of-week (end-of-month start)))] [else - (scm-error 'misc-error "html-main" (_ "Unknown html style: ~a") (list style) #f)]) + (scm-error 'misc-error "html-main" (G_ "Unknown html style: ~a") (list style) #f)]) - ((@ (calp util time) report-time!) (_ "all done")) + ((@ (calp util time) report-time!) (G_ "all done")) ) diff --git a/module/calp/entry-points/ical.scm b/module/calp/entry-points/ical.scm index e164c340..3720d8db 100644 --- a/module/calp/entry-points/ical.scm +++ b/module/calp/entry-points/ical.scm @@ -12,9 +12,9 @@ (define opt-spec `((from (value #t) (single-char #\F)) (to (value #t) (single-char #\T) - (description ,(_ "Returns all elements between these two dates."))) + (description ,(G_ "Returns all elements between these two dates."))) (help (single-char #\h) - (description ,(_ "Print this help."))))) + (description ,(G_ "Print this help."))))) (define (main args) (define opts (getopt-long args (getopt-opt opt-spec))) diff --git a/module/calp/entry-points/import.scm b/module/calp/entry-points/import.scm index 00edc0d8..ecf8b939 100644 --- a/module/calp/entry-points/import.scm +++ b/module/calp/entry-points/import.scm @@ -16,11 +16,11 @@ (define options `((calendar (value #t) (single-char #\c) - (description ,(_ "Name of calendar to import into"))) + (description ,(G_ "Name of calendar to import into"))) (file (value #t) (single-char #\f) - (description ,(_ "ics file to import"))) + (description ,(G_ "ics file to import"))) (help (single-char #\h) - (description ,(_ "Print this help."))))) + (description ,(G_ "Print this help."))))) (define (main args) (define opts (getopt-long args (getopt-opt options))) @@ -39,18 +39,18 @@ (get-calendars global-event-object))))) (unless calendar - (format (current-error-port) (_ "No calendar named ~s~%") cal-name) + (format (current-error-port) (G_ "No calendar named ~s~%") cal-name) (throw 'return)) (let ((new-events (parse-cal-path fname))) - (format #t (_ "About to import the following ~a events into ~a~%") + (format #t (G_ "About to import the following ~a events into ~a~%") (length (children new-events)) (prop calendar 'NAME)) (format #t "~{~a~^~%~}~%" (map (extract 'SUMMARY) (children new-events))) - (format #t (_ "Continue? [Y/n] ")) + (format #t (G_ "Continue? [Y/n] ")) (let loop ((line (read-line))) (case (if (string-null? line) 'yes (yes-no-check line)) diff --git a/module/calp/entry-points/server.scm b/module/calp/entry-points/server.scm index 903d085d..08c9d43a 100644 --- a/module/calp/entry-points/server.scm +++ b/module/calp/entry-points/server.scm @@ -17,22 +17,22 @@ (define options `((port (value #t) (single-char #\p) - (description ,(xml->sxml (_ "Bind to TCP port, defaults to 8080. + (description ,(xml->sxml (G_ "Bind to TCP port, defaults to 8080.
Can also be set through the config variable port.
")))) (addr (value #t) - (description ,(xml->sxml (_ "Address to use, defaults to 0.0.0.0 for IPv4, + (description ,(xml->sxml (G_ "Address to use, defaults to 0.0.0.0 for IPv4, and [::] for IPv6")))) ;; numbers as single-char doesn't work. - (six (description ,(_ "Use IPv6."))) - (four (description ,(_ "Use IPv4."))) - (sigusr (description ,(_ "Reload events on SIGUSR1"))) + (six (description ,(G_ "Use IPv6."))) + (four (description ,(G_ "Use IPv4."))) + (sigusr (description ,(G_ "Reload events on SIGUSR1"))) (help (single-char #\h) - (description ,(_ "Print this help."))))) + (description ,(G_ "Print this help."))))) (define-config port 8080 - description: (_ "Port to which the web server should bind.")) + description: (G_ "Port to which the web server should bind.")) (define (main args) @@ -59,12 +59,12 @@ and [::] for IPv6")))) "::" "0.0.0.0"))) (when (option-ref opts 'sigusr #f) - (format (current-error-port) (_ "Listening for SIGUSR1~%")) + (format (current-error-port) (G_ "Listening for SIGUSR1~%")) ;; NOTE this uses the main thread, and does therefore block HTTP requests ;; while reloading. However, it appears to not cause any race conditions. (sigaction SIGUSR1 (lambda _ - (format (current-error-port) (_ "Received SIGUSR1, reloading calendars~%")) + (format (current-error-port) (G_ "Received SIGUSR1, reloading calendars~%")) ((@ (vcomponent util instance) reload))))) @@ -74,7 +74,7 @@ and [::] for IPv6
")))) ;; Port which we listen to ;; PID of this process ;; PWD of this process - (format #t (_ "Starting server on ~a:~a~%I'm ~a, runing from ~a~%") + (format #t (G_ "Starting server on ~a:~a~%I'm ~a, runing from ~a~%") addr port% (getpid) (getcwd)) diff --git a/module/calp/entry-points/terminal.scm b/module/calp/entry-points/terminal.scm index dd35b8f3..9a1b8b00 100644 --- a/module/calp/entry-points/terminal.scm +++ b/module/calp/entry-points/terminal.scm @@ -11,8 +11,8 @@ (define options `((date (value #t) (single-char #\d) - (description ,(_ "Which date to start on."))) - (help (single-char #\t) (description ,(_ "Print this help."))) + (description ,(G_ "Which date to start on."))) + (help (single-char #\t) (description ,(G_ "Print this help."))) )) (define (main args) diff --git a/module/calp/entry-points/text.scm b/module/calp/entry-points/text.scm index 775245eb..127798ce 100644 --- a/module/calp/entry-points/text.scm +++ b/module/calp/entry-points/text.scm @@ -12,11 +12,11 @@ (define options `((width (value #t) (single-char #\w) - (description ,(_ "Width of written text, defaults to 70 chars."))) + (description ,(G_ "Width of written text, defaults to 70 chars."))) (file (value #t) (single-char #\f) - (description ,(xml->sxml (_ "Read from file instead of standard input.")))) + (description ,(xml->sxml (G_ "Read from file instead of standard input.")))) (help (single-char #\h) - (description ,(_ "Prints this help."))))) + (description ,(G_ "Prints this help."))))) (define (main args) (define opts (getopt-long args (getopt-opt options))) diff --git a/module/calp/entry-points/tidsrapport.scm b/module/calp/entry-points/tidsrapport.scm index a50f0659..b5b9564f 100644 --- a/module/calp/entry-points/tidsrapport.scm +++ b/module/calp/entry-points/tidsrapport.scm @@ -165,19 +165,19 @@ trailer (define opt-spec `((pdf (value #t) - (description ,(_ "Input pdf file"))) + (description ,(G_ "Input pdf file"))) (output (single-char #\o) (value optional) - (description ,(_ "Output file"))) + (description ,(G_ "Output file"))) (data (value optional) - (description ,(_ "Static data to fill fields with")) + (description ,(G_ "Static data to fill fields with")) ) (template (value optional) - (description ,(xml->sxml (_ "Map between real field names and human readable names.
+ (description ,(xml->sxml (G_ "Map between real field names and human readable names.
If data is given, but not trans, then data is assumed to be in a correct format
")))) (search (value #t) (description - ,(_ "Search term for dynamic filling. Supports basic globbing"))))) + ,(G_ "Search term for dynamic filling. Supports basic globbing"))))) (define (parse-search str) (cond [(string-match "\\{(.*)\\}" str) @@ -203,7 +203,7 @@ If data is given, but not trans, then data is assumed to be in a correct format< (define template (call-with-input-file (or (option-ref opts 'template #f) - (error (_ "Template required"))) + (error (G_ "Template required"))) read)) (define prepared-data @@ -231,9 +231,9 @@ If data is given, but not trans, then data is assumed to be in a correct format< (define days (let ((days (assoc-ref group 'days))) (cond ((not (list? days)) - (error (_ "Needs list, not pair"))) + (error (G_ "Needs list, not pair"))) ((null? days) - (error (_ "Need more days"))) + (error (G_ "Need more days"))) ((and (list? (car days)) (eqv? '- (caar days))) (map (lambda (s) (string-append prefix (->string s))) (iota (1+ (- (list-ref (car days) 2) @@ -249,7 +249,7 @@ If data is given, but not trans, then data is assumed to be in a correct format< ,@(build-alist work-hours days) (,sum ,(apply + work-hours)))) (or (assoc-ref template 'groups) - (error (_ "Groups required in template"))) + (error (G_ "Groups required in template"))) search))) (define report diff --git a/module/calp/entry-points/update-zoneinfo.scm b/module/calp/entry-points/update-zoneinfo.scm index b565faeb..c6be1af3 100644 --- a/module/calp/entry-points/update-zoneinfo.scm +++ b/module/calp/entry-points/update-zoneinfo.scm @@ -14,7 +14,7 @@ :use-module (calp translation)) (define opt-spec - `((help (single-char #\h) (description ,(_ "Print this help."))))) + `((help (single-char #\h) (description ,(G_ "Print this help."))))) (define (main args) (define opts (getopt-long args (getopt-opt opt-spec))) @@ -27,7 +27,7 @@ (path-append (xdg-data-home) "tzget"))) (filename (or (find file-exists? locations) (scm-error 'missing-helper "update-zoneinfo" - (_ "tzget not installed, please put it in one of ~a") + (G_ "tzget not installed, please put it in one of ~a") (list locations) (list "tzget" locations)))) diff --git a/module/calp/html/caltable.scm b/module/calp/html/caltable.scm index 2c027c35..bdbcf55f 100644 --- a/module/calp/html/caltable.scm +++ b/module/calp/html/caltable.scm @@ -58,7 +58,7 @@ ;; Cell 0, 0. The letter v. for week number (div (@ (class "column-head row-head")) - ,(_ "v.")) + ,(G_ "v.")) ;; top row, names of week days ,@(map (lambda (d) `(div (@ (class "column-head")) diff --git a/module/calp/html/components.scm b/module/calp/html/components.scm index df30b6bc..463bae38 100644 --- a/module/calp/html/components.scm +++ b/module/calp/html/components.scm @@ -54,7 +54,7 @@ rest: args) (when (and onclick href) (scm-error 'wrong-type-arg "btn" - (_ "href and onclick are mutually exclusive. href = ~s, onclick = ~s.") + (G_ "href and onclick are mutually exclusive. href = ~s, onclick = ~s.") (list href onclick) #f)) (let ((classes (string-join (cons "btn" class) " ")) diff --git a/module/calp/html/util.scm b/module/calp/html/util.scm index 948cadb7..0a5b44ae 100644 --- a/module/calp/html/util.scm +++ b/module/calp/html/util.scm @@ -33,6 +33,6 @@ #xFF)) "#000000" "#FFFFFF"))) (lambda args - (format (current-error-port) (_ "Error calculating foreground color?~%~s~%") args) + (format (current-error-port) (G_ "Error calculating foreground color?~%~s~%") args) "#FF0000" ))) diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 6d4f3ca7..0516b9d4 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -56,10 +56,10 @@ (configuration-error (lambda (key subr msg args data) (format (current-error-port) - (_ "Error retrieving configuration, ~?~%") msg args))) + (G_ "Error retrieving configuration, ~?~%") msg args))) (#t ; for errors when running the filter (lambda (err . args) - (warning (_ "~a on formatting description, ~s") err args) + (warning (G_ "~a on formatting description, ~s") err args) str)))) ;; TODO replace with propper mimetype parser @@ -91,11 +91,11 @@ "unknown"))))) (time ,(let ((dt (prop event 'DTSTART))) (if (datetime? dt) - (datetime->string dt (_ "~Y-~m-~d ~H:~M")) - (date->string dt (_ "~Y-~m-~d") )))) + (datetime->string dt (G_ "~Y-~m-~d ~H:~M")) + (date->string dt (G_ "~Y-~m-~d") )))) (a (@ (href ,(date->string (as-date (prop event 'DTSTART)) "/week/~Y-~m-~d.html"))) ;; Button for viewing calendar, accompanied by a calendar icon - ,(_ "View") " 📅") + ,(G_ "View") " 📅") (span ,(prop event 'SUMMARY))))) (cons `(style ,(lambda () (calendar-styles calendars #t))) @@ -166,7 +166,7 @@ (div (@ (class "fields")) ,(when (and=> (prop ev 'LOCATION) (negate string-null?)) - `(div (b ,(_ "Location: ")) + `(div (b ,(G_ "Location: ")) (div (@ (class "location") (data-property "location")) ,(string-map (lambda (c) (if (char=? c #\,) #\newline c)) (prop ev 'LOCATION))))) @@ -244,10 +244,10 @@ ,@(format-recurrence-rule ev))) ,(when (prop ev 'LAST-MODIFIED) - `(div (@ (class "last-modified")) ,(_ "Last modified") " " + `(div (@ (class "last-modified")) ,(G_ "Last modified") " " ,(datetime->string (prop ev 'LAST-MODIFIED) ;; Last modified datetime - (_ "~1 ~H:~M"))))) + (G_ "~1 ~H:~M"))))) )))) @@ -258,7 +258,7 @@ (let ((date (car day)) (events (cdr day))) `(section (@ (class "text-day")) - (header (h2 ,(let ((s (date->string date (_ "~Y-~m-~d")))) + (header (h2 ,(let ((s (date->string date (G_ "~Y-~m-~d")))) `(a (@ (href "#" ,s) (class "hidelink")) ,s)))) ,@(stream->list @@ -340,7 +340,7 @@ ;; TODO possibly unused? (define (repeat-info event) `(div (@ (class "eventtext")) - (h2 ,(_ "Recurrences")) + (h2 ,(G_ "Recurrences")) (table (@ (class "recur-components")) ,@((@@ (vcomponent recurrence internal) map-fields) (lambda (key value) @@ -412,7 +412,7 @@ (form (@ (class "edit-form")) (select (@ (class "calendar-selection")) ;; NOTE flytta "muffarna" utanför - (option ,(_ "- Choose a Calendar -")) + (option ,(G_ "- Choose a Calendar -")) ,@(let ((dflt ((@ (vcomponent) default-calendar)))) (map (lambda (calendar) (define name (prop calendar 'NAME)) @@ -422,7 +422,7 @@ ,name)) calendars))) (input (@ (type "text") - (placeholder ,(_ "Summary")) + (placeholder ,(G_ "Summary")) (name "summary") (required) (data-property "summary") ; (value ,(prop ev 'SUMMARY)) @@ -440,25 +440,25 @@ (div (@ (class "checkboxes")) (input (@ (type "checkbox") (name "wholeday") - (data-label ,(_ "Whole day?")) + (data-label ,(G_ "Whole day?")) )) (input (@ (type "checkbox") (name "has_repeats") - (data-label ,(_ "Recurring?")) + (data-label ,(G_ "Recurring?")) ))) ) - (input (@ (placeholder ,(_ "Location")) - (data-label ,(_ "Location")) + (input (@ (placeholder ,(G_ "Location")) + (data-label ,(G_ "Location")) (name "location") (type "text") (data-property "location") ; (value ,(or (prop ev 'LOCATION) "")) )) - (textarea (@ (placeholder ,(_ "Description")) - (data-label ,(_ "Description")) + (textarea (@ (placeholder ,(G_ "Description")) + (data-label ,(G_ "Description")) (data-property "description") (name "description")) ; ,(prop ev 'DESCRIPTION) @@ -467,9 +467,9 @@ (input-list (@ (name "categories") (data-property "categories") - (data-label ,(_ "Categories"))) + (data-label ,(G_ "Categories"))) (input (@ (type "text") - (placeholder ,(_ "Category"))))) + (placeholder ,(G_ "Category"))))) ;; TODO This should be a "list" where any field can be edited ;; directly. Major thing holding us back currently is that @@ -518,7 +518,7 @@ ; "20:56" )) (div (@ (class "fields")) - (div (b ,(_ "Location: ")) + (div (b ,(G_ "Location: ")) (div (@ (class "location") (data-property "location")) ; "Alsättersgatan 13" @@ -540,7 +540,7 @@ ;; "varje vecka" ;; ".") (div (@ (class "last-modified")) - ,(_ "Last Modified") " -" + ,(G_ "Last Modified") " -" ; "2021-09-29 19:56" )))))) @@ -548,21 +548,21 @@ `(template (@ (id "vevent-edit-rrule")) (div (@ (class "eventtext")) - (h2 ,(_ "Recurrences")) + (h2 ,(G_ "Recurrences")) (dl - (dt ,(_ "Frequency")) + (dt ,(G_ "Frequency")) (dd (select (@ (name "freq")) (option "-") ,@(map (lambda (x) `(option (@ (value ,x)) ,(string-titlecase (symbol->string x)))) '(SECONDLY MINUTELY HOURLY DAILY WEEKLY MONTHLY YEARLY)))) - (dt ,(_ "Until")) + (dt ,(G_ "Until")) (dd (date-time-input (@ (name "until")))) - (dt ,(_ "Conut")) + (dt ,(G_ "Conut")) (dd (input (@ (type "number") (name "count") (min 0)))) - (dt ,(_ "Interval")) + (dt ,(G_ "Interval")) (dd (input (@ (type "number") (name "interval") ; min and max depend on FREQ ))) @@ -576,14 +576,14 @@ (dd (input-list (@ (name ,name)) (input (@ (type "number") (min ,min) (max ,max))))))) - `((bysecond ,(_ "By Second") 0 60) - (byminute ,(_ "By Minute") 0 59) - (byhour ,(_ "By Hour") 0 23) - (bymonthday ,(_ "By Month Day") -31 31) ; except 0 - (byyearday ,(_ "By Year Day") -366 366) ; except 0 - (byweekno ,(_ "By Week Number") -53 53) ; except 0 - (bymonth ,(_ "By Month") 1 12) - (bysetpos ,(_ "By Set Position") -366 366) ; except 0 + `((bysecond ,(G_ "By Second") 0 60) + (byminute ,(G_ "By Minute") 0 59) + (byhour ,(G_ "By Hour") 0 23) + (bymonthday ,(G_ "By Month Day") -31 31) ; except 0 + (byyearday ,(G_ "By Year Day") -366 366) ; except 0 + (byweekno ,(G_ "By Week Number") -53 53) ; except 0 + (bymonth ,(G_ "By Month") 1 12) + (bysetpos ,(G_ "By Set Position") -366 366) ; except 0 ))) ;; (dt "By Week Day") @@ -594,7 +594,7 @@ ;; ,(week-day-select '()) ;; )) - (dt ,(_ "Weekstart")) + (dt ,(G_ "Weekstart")) (dd ,(week-day-select '((name "wkst"))))))) ) @@ -610,29 +610,29 @@ (nav (@ (class "popup-control")) (button (@ (class "close-button") ;; Close this popup - (title ,(_ "Close")) + (title ,(G_ "Close")) (aria-label "Close")) "×") (button (@ (class "maximize-button") ;; Make this popup occupy the entire screen - (title ,(_ "Fullscreen")) + (title ,(G_ "Fullscreen")) ;; (aria-label "") ) ,(xml-entities "🗖")) (button (@ (class "remove-button") ;; Remove/Trash the event this popup represent ;; Think garbage can - (title ,(_ "Remove"))) + (title ,(G_ "Remove"))) ,(xml-entities "🗑"))) (tab-group (@ (class "window-body")) (vevent-description - (@ (data-label ,(xml-entities "📅")) (data-title ,(_ "Overview")) + (@ (data-label ,(xml-entities "📅")) (data-title ,(G_ "Overview")) (class "vevent"))) (vevent-edit (@ (data-label ,(xml-entities "🖊")) - (data-title ,(_ "Edit")) + (data-title ,(G_ "Edit")) ;; Used by JavaScript to target this tab (data-originaltitle "Edit"))) @@ -641,9 +641,9 @@ (vevent-changelog (@ (data-label ,(xml-entities "📒")) - (data-title ,(_ "Changelog")))) + (data-title ,(G_ "Changelog")))) ,@(when (debug) `((vevent-dl (@ (data-label ,(xml-entities "🐸")) - (data-title ,(_ "Debug")))))))))) + (data-title ,(G_ "Debug")))))))))) diff --git a/module/calp/html/view/calendar.scm b/module/calp/html/view/calendar.scm index 99109741..a240d00c 100644 --- a/module/calp/html/view/calendar.scm +++ b/module/calp/html/view/calendar.scm @@ -78,10 +78,10 @@ ,display))) (unless next-start - (scm-error 'misc-error "html-generate" (_ "Next-start needs to be a procedure") #f #f)) + (scm-error 'misc-error "html-generate" (G_ "Next-start needs to be a procedure") #f #f)) (unless prev-start - (scm-error 'misc-error "html-generate" (_ "Prev-start needs to be a procedure") #f #f)) + (scm-error 'misc-error "html-generate" (G_ "Prev-start needs to be a procedure") #f #f)) (xhtml-doc (@ (lang sv)) @@ -92,9 +92,9 @@ (meta (@ (name viewport) (content "width=device-width, initial-scale=0.5"))) (meta (@ (name description) - (content ,(format #f (_ "Calendar for the dates between ~a and ~a") - (date->string start-date (_ "~Y-~m-~d")) - (date->string end-date (_ "~Y-~m-~d")))))) + (content ,(format #f (G_ "Calendar for the dates between ~a and ~a") + (date->string start-date (G_ "~Y-~m-~d")) + (date->string end-date (G_ "~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) @@ -154,11 +154,11 @@ window.default_calendar='~a';" ;; Page footer (footer (@ (style "grid-area: footer")) - (span ,(_ "Page generated ") - ,(date->string (current-date) (_ "~Y-~m-~d"))) - (span ,(_ "Current time ") (current-time (@ (interval 1)))) + (span ,(G_ "Page generated ") + ,(date->string (current-date) (G_ "~Y-~m-~d"))) + (span ,(G_ "Current time ") (current-time (@ (interval 1)))) (span (a (@ (href ,(repo-url))) - ,(_ "Source Code")))) + ,(G_ "Source Code")))) ;; Small calendar and navigation (nav (@ (class "calnav") (style "grid-area: nav")) @@ -169,11 +169,11 @@ window.default_calendar='~a';" start-date) "/week/~1.html") ;; Button to view week - (_ "Week")) + (G_ "Week")) ,(btn href: (date->string (set (day start-date) 1) "/month/~1.html") ;; button to view month - (_ "Month")) + (G_ "Month")) (today-button (a (@ (class "btn") @@ -183,7 +183,7 @@ window.default_calendar='~a';" [(week) "view=week"] [else ""])))) ;; Button to go to today - ,(_ "Today")))) + ,(G_ "Today")))) (date-jump ;; Firefox's accessability complain about each date @@ -203,11 +203,11 @@ window.default_calendar='~a';" ,(btn "➔")))) (details (@ (open) (style "grid-area: cal")) - (summary ,(_ "Month overview")) + (summary ,(G_ "Month overview")) (div (@ (class "smallcall-head")) ,(string-titlecase (date->string start-date ;; Header of small calendar - (_ "~B ~Y")))) + (G_ "~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. @@ -233,16 +233,16 @@ window.default_calendar='~a';" (input (@ (type "text") (name "q") ;; Search placeholder - (placeholder ,(_ "Search")))) + (placeholder ,(G_ "Search")))) (input (@ (type "submit") (value ">")))) ,(when (or (debug) (edit-mode)) `(details (@ (class "sliders")) - (summary ,(_ "Option sliders")) + (summary ,(G_ "Option sliders")) ,@(when (edit-mode) - `((label ,(_ "Event blankspace")) + `((label ,(G_ "Event blankspace")) ,(slider-input variable: "editmode" min: 0 @@ -251,7 +251,7 @@ window.default_calendar='~a';" value: 1))) ,@(when (debug) - `((label ,(_ "Fontsize")) + `((label ,(G_ "Fontsize")) ,(slider-input unit: "pt" min: 1 @@ -262,7 +262,7 @@ window.default_calendar='~a';" ;; List of calendars (details (@ (class "calendarlist")) - (summary ,(_ "Calendar list")) + (summary ,(G_ "Calendar list")) (ul ,@(map (lambda (calendar) `(li (@ (data-calendar ,(base64encode (prop calendar 'NAME)))) @@ -288,7 +288,7 @@ window.default_calendar='~a';" ;; Events which started before our start point, ;; but "spill" into our time span. (section (@ (class "text-day")) - (header (h2 ,(_ "Earlier"))) + (header (h2 ,(G_ "Earlier"))) ;; TODO this group gets styles applied incorrectly. ;; Figure out way to merge it with the below call. ,@(stream->list diff --git a/module/calp/html/view/calendar/shared.scm b/module/calp/html/view/calendar/shared.scm index 4779d11b..413bb5f5 100644 --- a/module/calp/html/view/calendar/shared.scm +++ b/module/calp/html/view/calendar/shared.scm @@ -36,7 +36,7 @@ (unless event-length-key (scm-error 'wrong-type-arg "fix-event-widths!" - (_ "event-length-key is required") + (G_ "event-length-key is required") #f #f)) ;; @var{x} is how for left in the container we are. diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm index caad8912..44898b0d 100644 --- a/module/calp/html/view/calendar/week.scm +++ b/module/calp/html/view/calendar/week.scm @@ -36,7 +36,7 @@ ;; Top left area (div (@ (class "week-indicator")) (span (@ (style "font-size: 50%")) - ,(_ "v.")) + ,(G_ "v.")) ,@(->> (week-number start-date) number->string string->list (map (lambda (c) `(span ,(string c)))))) @@ -49,7 +49,7 @@ ,@(map (lambda (day-date) `(div (@ (class "meta")) (span (@ (class "daydate")) - ,(date->string day-date (_ "~Y-~m-~d"))) + ,(date->string day-date (G_ "~Y-~m-~d"))) (span (@ (class "dayname")) ;; TODO translation here? ,(string-titlecase (date->string day-date "~a"))))) diff --git a/module/calp/html/view/search.scm b/module/calp/html/view/search.scm index 114541ed..7b991104 100644 --- a/module/calp/html/view/search.scm +++ b/module/calp/html/view/search.scm @@ -26,25 +26,25 @@ errors has-query? search-term search-result page paginator) (xhtml-doc (@ (lang sv)) - (head (title ,(_ "Search results")) + (head (title ,(G_ "Search results")) ,(include-css "/static/style.css")) (body - (a (@ (href ("/today"))) ,(_ "Show today")) - (h2 ,(_ "Search term")) + (a (@ (href ("/today"))) ,(G_ "Show today")) + (h2 ,(G_ "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")) ,(G_ "limit to future occurences")) (input (@ (name "onlyfuture") (id "onlyfuture") (type checkbox))) (input (@ (type submit)))) ,@(if errors - `((h2 ,(_ "Error searching")) + `((h2 ,(G_ "Error searching")) (div (@ (class "error")) (pre ,errors))) - `((h2 ,(format #f (_ "Result (page ~a)") page)) + `((h2 ,(format #f (G_ "Result (page ~a)") page)) (ul ,@(compact-event-list search-result)) (div (@ (class "paginator")) ,@(paginator->list diff --git a/module/calp/main.scm b/module/calp/main.scm index 827dbf4e..265b83aa 100644 --- a/module/calp/main.scm +++ b/module/calp/main.scm @@ -35,11 +35,11 @@ (define options `((statprof (value display-style) - (description ,(xml->sxml (_ "Run the program within Guile's built in statical + (description ,(xml->sxml (G_ "Run the program within Guile's built in statical profiler. Display style is one of flat or tree.")))) (repl (value address) (description - ,(xml->sxml (_ "Start a Guile repl which can be connected to, defaults to the + ,(xml->sxml (G_ "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. @@ -48,22 +48,22 @@ contain all events. (config (value #t) (description - ,(_ "Path to alterantive configuration file to load instead of the default one."))) + ,(G_ "Path to alterantive configuration file to load instead of the default one."))) (debug (single-char #\d) (description - ,(_ "Turns on debug mode for HTML output"))) + ,(G_ "Turns on debug mode for HTML output"))) (edit-mode (description - ,(_ "Makes generated HTML user editable (through JS)"))) + ,(G_ "Makes generated HTML user editable (through JS)"))) (version (single-char #\v) - (description ,(format #f (_ "Display version, which is ~a btw.") + (description ,(format #f (G_ "Display version, which is ~a btw.") (@ (calp) version)))) (help (single-char #\h) - (description ,(_ "Print this help"))) + (description ,(G_ "Print this help"))) )) @@ -73,30 +73,30 @@ contain all events. "
" "Calp" "


-" (_ "Usage: calp [ flags ] mode [ mode flags ]") "
+" (G_ "Usage: calp [ flags ] mode [ mode flags ]") "

" ;; Header for following list of modes of operation - "
" (_ "Modes") "
+ "
" (G_ "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, + (G_ "

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

") + (G_ "

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

") + (G_ "[UNTESTED]

imports a calendar object into the database.

") + (G_ "

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 + (G_ "

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' + (G_ "

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

") - (_ "

server starts an HTTP server which dynamically loads and + (G_ "

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.

") - (_ "

update-zoneinfo in theory downloads and updates our local + (G_ "

update-zoneinfo in theory downloads and updates our local zoneinfo database, but is currently broken.

") "

" ;; Header for list of available flags. ;; Actual list is auto generated elsewhere. - "
" (_ "Flags") "
+ "
" (G_ "Flags") "

"))) (define (ornull a b) @@ -115,7 +115,7 @@ zoneinfo database, but is currently broken.

") altconfig (scm-error 'misc-error "wrapped-main" - (_ "Configuration file ~a missing") + (G_ "Configuration file ~a missing") (list altconfig) #f))] ;; altconfig could be placed in the list below. But I want to raise an error @@ -141,7 +141,7 @@ zoneinfo database, but is currently broken.

") ;; Two arguments: ;; Configuration file path, ;; thrown error arguments - (_ "Failed loading config file ~a~%~s~%") + (G_ "Failed loading config file ~a~%~s~%") config-file args ))) @@ -162,7 +162,7 @@ zoneinfo database, but is currently broken.

") (throw 'return)) (when (option-ref opts 'version #f) - (format #t (_ "Calp version ~a~%") (@ (calp) version)) + (format #t (G_ "Calp version ~a~%") (@ (calp) version)) (throw 'return)) ;; always load zoneinfo if available. @@ -194,7 +194,7 @@ zoneinfo database, but is currently broken.

") ((update-zoneinfo) (@ (calp entry-points update-zoneinfo) main)) (else => (lambda (s) (format (current-error-port) - (_ "Unsupported mode of operation: ~a~%") + (G_ "Unsupported mode of operation: ~a~%") s) (exit 1)))) ropt)) @@ -209,7 +209,7 @@ zoneinfo database, but is currently broken.

") (define (main args) - ((@ (calp util time) report-time!) (_ "Program start")) + ((@ (calp util time) report-time!) (G_ "Program start")) (with-throw-handler #t (lambda () (dynamic-wind (lambda () 'noop) diff --git a/module/calp/repl.scm b/module/calp/repl.scm index aaa1061c..b0281f07 100644 --- a/module/calp/repl.scm +++ b/module/calp/repl.scm @@ -15,7 +15,7 @@ (define (repl-start address) (define lst (string->list address)) (format (current-error-port) - (_ "Starting REPL server at ~a~%") address) + (G_ "Starting REPL server at ~a~%") address) (spawn-server (case (cond [(memv (car lst) '(#\. #\/)) 'UNIX] [(string-match "(\\d{1,3}\\.){3}\\d{1,3}(:\\d+)?" address) 'IPv4] @@ -25,17 +25,17 @@ [(UNIX) (add-hook! shutdown-hook (lambda () (catch 'system-error (lambda () (delete-file address)) (lambda (err proc fmt args data) - (warning (string-append (format #f (_ "Failed to unlink ~a") address) + (warning (string-append (format #f (G_ "Failed to unlink ~a") address) (format #f ": ~?" fmt args))) err)))) (make-unix-domain-server-socket path: address)] [(IPv4) (apply (case-lambda - [() (error (_ "Empty address?"))] + [() (error (G_ "Empty address?"))] [(address) (make-tcp-server-socket host: address)] [(address port) (make-tcp-server-socket host: address port: port)]) (string-split address #\:))] ;; currently impossible - [(IPv6) (error (_ "How did you get here?"))])) + [(IPv6) (error (G_ "How did you get here?"))])) ;; TODO setup repl environment here diff --git a/module/calp/server/routes.scm b/module/calp/server/routes.scm index 6701d8b4..1f622c2a 100644 --- a/module/calp/server/routes.scm +++ b/module/calp/server/routes.scm @@ -61,18 +61,18 @@ `(table (@ (class "directory-table")) (thead (tr (th "") - (th ,(_ "Name")) + (th ,(G_ "Name")) ;; File permissions, should be about as long as three digits - (th ,(_ "Perm")) + (th ,(G_ "Perm")) ;; File size - (th ,(_ "Size")))) + (th ,(G_ "Size")))) (tbody (tr (td "↩️") (td (@ (colspan 3)) (a (@ (href ,(-> (path-split dir) (drop-right 1) (xcons "/static") path-join))) - ,(_ "Return up")))) + ,(G_ "Return up")))) ,@(map (lambda (k) (let ((stat (lstat (path-append prefix dir k)))) `(tr (td ,(case (stat:type stat) @@ -95,7 +95,7 @@ (scm-error 'misc-error "directory-table" - (_ "Scandir argument invalid or not directory: ~s") + (G_ "Scandir argument invalid or not directory: ~s") (list dir) '()))))))) @@ -118,7 +118,7 @@ (define-config static-dir "static" - description: (_ "Where static files for the web server are located")) + description: (G_ "Where static files for the web server are located")) (define ical-namespace '(IC . "urn:ietf:params:xml:ns:icalendar-2.0")) @@ -140,7 +140,7 @@ (lambda () ((sxml->output html) (xhtml-doc - (body (a (@ (href "/today")) ,(_ "Go to Today")) + (body (a (@ (href "/today")) ,(G_ "Go to Today")) (script ,(lambda () (display root-script)))))))))) (GET "/favicon.ico" () @@ -188,7 +188,7 @@ (POST "/remove" (uid) (unless uid (return (build-response code: 400) - (_ "uid required"))) + (G_ "uid required"))) (aif (get-event-by-uid global-event-object uid) (begin @@ -200,10 +200,10 @@ (set! (param (prop* it 'X-HNH-REMOVED) 'VALUE) "BOOLEAN") (unless ((@ (vcomponent formats vdir save-delete) save-event) it) (return (build-response code: 500) - (_ "Saving event to disk failed."))) + (G_ "Saving event to disk failed."))) (return (build-response code: 204))) (return (build-response code: 400) - (format #f (_ "No event with UID '~a'") uid)))) + (format #f (G_ "No event with UID '~a'") uid)))) ;; TODO this fails when dtstart is . ;; @var{cal} should be the name of the calendar encoded in base64. @@ -211,7 +211,7 @@ (unless (and cal data) (return (build-response code: 400) - (string-append (_ "Both 'cal' and 'data' required") "\r\n"))) + (string-append (G_ "Both 'cal' and 'data' required") "\r\n"))) ;; NOTE that this leaks which calendar exists, ;; but you can only query for existance. @@ -222,7 +222,7 @@ (unless calendar (return (build-response code: 400) - (format #f "~@?\r\n" (_ "No calendar with name [~a]") + (format #f "~@?\r\n" (G_ "No calendar with name [~a]") calendar-name))) ;; Expected form of data (but in XML) is: @@ -253,12 +253,12 @@ (lambda (err port . args) (return (build-response code: 400) (format #f "~a ~{~a~}\r\n" - (_ "XML parse error") + (G_ "XML parse error") args))))))) (unless (eq? 'VEVENT (type event)) (return (build-response code: 400) - (string-append (_ "Object not a VEVENT") "\r\n"))) + (string-append (G_ "Object not a VEVENT") "\r\n"))) ;; NOTE add-event uses the given UID if one is given, ;; but generates its own if not. It might be a good idea @@ -334,7 +334,7 @@ ;; and "program parent" into different fields. (lambda () (sxml->xml ((@ (vcomponent formats xcal output) vcomponent->sxcal) it))))) (return (build-response code: 404) - (format #f (_ "No component with UID=~a found.") uid)))) + (format #f (G_ "No component with UID=~a found.") uid)))) (GET "/calendar/:uid{.*}.ics" (uid) (aif (get-event-by-uid global-event-object uid) @@ -343,7 +343,7 @@ (lambda () (print-components-with-fake-parent (list it))))) (return (build-response code: 404) - (format #f (_ "No component with UID=~a found.") uid)))) + (format #f (G_ "No component with UID=~a found.") uid)))) (GET "/search/text" (q) (return (build-response @@ -448,7 +448,7 @@ (lambda () ((sxml->output html) (xhtml-doc - (head (title ,(_ "Calp directory listing for ") path) + (head (title ,(G_ "Calp directory listing for ") path) ,(include-css "/static/directory-listing.css")) (body ,(directory-table (static-dir) path)))))))) diff --git a/module/calp/terminal.scm b/module/calp/terminal.scm index ee3b7bc4..04effd68 100644 --- a/module/calp/terminal.scm +++ b/module/calp/terminal.scm @@ -76,7 +76,7 @@ " │ " (if (prop ev 'LOCATION) "" "\x1b[1;30m") (trim-to-width - (or (prop ev 'LOCATION) (_ "NO LOCATION")) location-width) + (or (prop ev 'LOCATION) (G_ "NO LOCATION")) location-width) STR-RESET "\n"))) events @@ -127,7 +127,7 @@ (cls) - (display (_ "== Day View ==")) + (display (G_ "== Day View ==")) (newline) (display-calendar-header! (current-page this)) @@ -148,24 +148,24 @@ (awhen (prop ev 'LOCATION) (format #t "\x1b[1m~a:\x1b[m ~a~%" - (_ "Location") + (G_ "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") + (G_ "Start") (let ((start (prop ev 'DTSTART))) (if (datetime? start) (datetime->string (prop ev 'DTSTART) - (_ "~Y-~m-~d ~H:~M:~S")) + (G_ "~Y-~m-~d ~H:~M:~S")) (date->string start)))) (format #t "\x1b[1m~a:\x1b[m ~a~%~%" - (_ "End") + (G_ "End") (let ((start (prop ev 'DTSTART))) (if (datetime? start) (datetime->string (prop ev 'DTSTART) - (_ "~Y-~m-~d ~H:~M:~S")) + (G_ "~Y-~m-~d ~H:~M:~S")) (date->string start)))) (format #t "~a~%" (unlines (take-to (flow-text (or (prop ev 'DESCRIPTION) "") @@ -208,14 +208,14 @@ (active-element this) 0)) ((#\/) (set-cursor-pos 0 (1- height)) - (let ((search-term (get-line (_ "quick search: ")))) + (let ((search-term (get-line (G_ "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 (G_ "search: ")))) `(push ,(search-view search-term (get-event-set this))))) (else (next-method)))) @@ -261,7 +261,7 @@ (cls) - (display (_ "== Search View ==\n")) + (display (G_ "== Search View ==\n")) ;; display search term (format #t "~y" (search-term this)) @@ -317,7 +317,7 @@ 'DTSTART))))) ((#\h left) (set! (current-page this) = ((lambda (old) (max 0 (1- old)))))) ((#\l right) - (format #t "~% ~a~%" (_ "loading...")) + (format #t "~% ~a~%" (G_ "loading...")) (set! (current-page this) (next-page (slot-ref this 'search-result) (current-page this)))) diff --git a/module/calp/translation.scm b/module/calp/translation.scm index 67189e7a..e99062db 100644 --- a/module/calp/translation.scm +++ b/module/calp/translation.scm @@ -3,7 +3,7 @@ :use-module (ice-9 regex) :use-module (ice-9 match) :use-module (srfi srfi-88) - :export (_ translate yes-no-check)) + :export (G_ translate yes-no-check)) (bindtextdomain "calp" "/home/hugo/code/calp/localization/") @@ -18,7 +18,7 @@ (gettext string "calp"))) ;; Mark string for translation, and also make it discoverable for gettext -(define (_ . msg) +(define (G_ . msg) (translate (string-join msg))) (define* (yes-no-check string optional: (locale %global-locale)) diff --git a/module/calp/util/config.scm b/module/calp/util/config.scm index aba2cd2c..d2bff5ac 100644 --- a/module/calp/util/config.scm +++ b/module/calp/util/config.scm @@ -19,7 +19,7 @@ args)) (define %configuration-error - (_ "Pre-property failed when setting ~s to ~s")) + (G_ "Pre-property failed when setting ~s to ~s")) (define-syntax-rule (define-once-public symbol binding) (begin (define-once symbol binding) @@ -27,7 +27,7 @@ (define-syntax (define-config stx) (syntax-case stx () - ((_ name default kw ...) + ((G_ name default kw ...) (let ((pre (cond ((memv pre: (fix-keywords #'(kw ...))) => cadr) (else #f))) (post (cond ((memv post: (fix-keywords #'(kw ...))) => cadr) (else #f)))) #`(define-once-public name diff --git a/module/calp/util/exceptions.scm b/module/calp/util/exceptions.scm index 5d6a71e8..6bfc2415 100644 --- a/module/calp/util/exceptions.scm +++ b/module/calp/util/exceptions.scm @@ -4,6 +4,6 @@ :use-module (hnh util exceptions)) (define-config warnings-are-errors #f - description: (_ "Crash on warnings.") + description: (G_ "Crash on warnings.") post: (@ (hnh util exceptions) warnings-are-errors) ) diff --git a/module/datetime/instance.scm b/module/datetime/instance.scm index d9a304b2..d6c84348 100644 --- a/module/datetime/instance.scm +++ b/module/datetime/instance.scm @@ -9,7 +9,7 @@ :export (zoneinfo)) (define-config tz-list '() - description: (_ "List of default zoneinfo files to be parsed")) + description: (G_ "List of default zoneinfo files to be parsed")) ;; TODO see (vcomponent uil instance), this has a similar problem with early load ;; Takes a list of zoneinfo files relative @@ -25,7 +25,7 @@ (() (define tz-list (tz-list)) (if (null? tz-list) - (warning (_ "Default zoneinfo only available when tz-dir and tz-list are configured")) + (warning (G_ "Default zoneinfo only available when tz-dir and tz-list are configured")) (self tz-list))) ((file-list) (provide 'zoneinfo) diff --git a/module/datetime/timespec.scm b/module/datetime/timespec.scm index 46f93a61..53eba014 100644 --- a/module/datetime/timespec.scm +++ b/module/datetime/timespec.scm @@ -42,7 +42,7 @@ (define (timespec-add . specs) (unless (apply eqv? (map timespec-type specs)) - (warning (_ "Adding timespecs of differing types"))) + (warning (G_ "Adding timespecs of differing types"))) (reduce (lambda (spec done) (cond diff --git a/module/datetime/zic.scm b/module/datetime/zic.scm index 66c0ba06..955ecd1c 100644 --- a/module/datetime/zic.scm +++ b/module/datetime/zic.scm @@ -186,7 +186,7 @@ day: (string->number day)) time: (timespec-time timespec) tz: (case (timespec-type timespec) - [(#\s) (warning (_ "what even is \"Standard time\"‽")) ""] + [(#\s) (warning (G_ "what even is \"Standard time\"‽")) ""] [(#\w) #f] ;; Since we might represent times before UTC existed ;; this is a bit of a lie. But it should work. @@ -274,7 +274,7 @@ ;; They were removed since they were unused, uneeded, and was ;; technical dept. (scm-error 'misc-error "parse-zic-file" - (_ "Invalid key ~s. Note that leap seconds and expries rules aren't yet implemented.") + (G_ "Invalid key ~s. Note that leap seconds and expries rules aren't yet implemented.") (list type) #f)))])))))) @@ -316,7 +316,7 @@ (target (link-target link)) (target-item (hash-ref zones target #f))) (if (not target-item) - (warning (_ "Unresolved link, target missing ~a -> ~a") name target) + (warning (G_ "Unresolved link, target missing ~a -> ~a") name target) (hash-set! zones name target-item)))) (car it))) @@ -355,7 +355,7 @@ (set (day d) base-day)))) tz: (case (timespec-type (rule-at rule)) ((#\w) #f) - ((#\s) (warning (_ "what even is \"Standard time\"‽")) #f) + ((#\s) (warning (G_ "what even is \"Standard time\"‽")) #f) ((#\u #\g #\z) "UTC")))) (let ((timespec (rule-at rule))) @@ -377,7 +377,7 @@ (case to ((maximum) #f) ((minimum) (scm-error 'misc-error "rule->rrule" - (_ "Check your input") + (G_ "Check your input") #f #f)) (else ;; NOTE I possibly need to check the start of @@ -390,7 +390,7 @@ (match (rule-on rule) ((? number? d) (set (bymonthday base) (list d))) (('last d) (set (byday base) (list (cons -1 d)))) - (('< wday base-day) (scm-error 'misc-error "rule->rrule" (_ "Counting backward for RRULES unsupported") #f #f)) + (('< wday base-day) (scm-error 'misc-error "rule->rrule" (G_ "Counting backward for RRULES unsupported") #f #f)) (('> wday base-day) ;; Sun<=25 ;; Sun>=8 @@ -412,14 +412,14 @@ [(#\z) ;; NOTE No zones seem to currently use %z formatting. ;; '%z' is NOT a format string, but information about another format string. - (warning (_ "%z not yet implemented")) + (warning (G_ "%z not yet implemented")) fmt-string] [else (scm-error 'misc-error "zone-format" ;; first slot is the errornous character, ;; second is the whole string, third is the index ;; of the faulty character. - (_ "Invalid format char ~s in ~s at position ~a") + (G_ "Invalid format char ~s in ~s at position ~a") (list (string-ref fmt-string (1+ idx)) fmt-string (1+ idx)) diff --git a/module/vcomponent/config.scm b/module/vcomponent/config.scm index b2598207..3bc51557 100644 --- a/module/vcomponent/config.scm +++ b/module/vcomponent/config.scm @@ -4,13 +4,13 @@ :use-module (calp util config)) (define-config calendar-files '() - description: (_ "Which files to parse. Takes a list of paths or a single string which will be globbed.") + description: (G_ "Which files to parse. Takes a list of paths or a single string which will be globbed.") pre: (lambda (v) (cond [(list? v) v] [(string? v) ((@ (glob) glob) v)] [else #f]))) (define-config default-calendar "" - description: (_ "Default calendar to use for operations. Set to empty string to unset") + description: (G_ "Default calendar to use for operations. Set to empty string to unset") pre: (ensure string?)) diff --git a/module/vcomponent/control.scm b/module/vcomponent/control.scm index 0869543d..19a6fa18 100644 --- a/module/vcomponent/control.scm +++ b/module/vcomponent/control.scm @@ -26,7 +26,7 @@ ;; TODO what is this even used for? (define-syntax with-replaced-properties (syntax-rules () - [(_ (component (key val) ...) + [(G_ (component (key val) ...) body ...) (let ((htable (make-hash-table 10))) diff --git a/module/vcomponent/datetime/output.scm b/module/vcomponent/datetime/output.scm index 614438da..736db0a4 100644 --- a/module/vcomponent/datetime/output.scm +++ b/module/vcomponent/datetime/output.scm @@ -17,27 +17,27 @@ ;; [FRR] ;; Part of the sentance "Repeated [every two weeks], except on ~a, ~a & ~a" ;; See everything tagged [FRR] - `(,(_ "Repeated ") + `(,(G_ "Repeated ") ,((@ (vcomponent recurrence display) format-recurrence-rule) (prop ev 'RRULE)) ,@(awhen (prop* ev 'EXDATE) (list ;; See [FRR] - (_ ", except on ") + (G_ ", except on ") (add-enumeration-punctuation (map (lambda (d) ;; TODO show year if different from current year (if (date? d) ;; [FRR] Exception date without time - (date->string d (_ "~e ~b")) + (date->string d (G_ "~e ~b")) ;; NOTE only show time when it's different than the start time? ;; or possibly only when FREQ is hourly or lower. (if (memv ((@ (vcomponent recurrence internal) freq) (prop ev 'RRULE)) '(HOURLY MINUTELY SECONDLY)) ;; [FRR] Exception date with time - (datetime->string d (_ "~e ~b ~k:~M")) + (datetime->string d (G_ "~e ~b ~k:~M")) ;; [FRR] Exception date without time - (datetime->string d (_ "~e ~b"))))) + (datetime->string d (G_ "~e ~b"))))) (map value it))))) ".")) @@ -52,7 +52,7 @@ ;; Warning message for failure to format description. ;; First argument is name of warning/error, ;; second is error arguments - (warning (_ "~a on formatting description, ~s") err args) + (warning (G_ "~a on formatting description, ~s") err args) str))) ;; Takes an event, and returns a pretty string for the time interval @@ -64,9 +64,9 @@ => (lambda (e) ;; start = end, only return one value (if (date= e (date+ s (date day: 1))) - (_ "~Y-~m-~d") - (values (_ "~Y-~m-~d") - (_ "~Y-~m-~d"))))] + (G_ "~Y-~m-~d") + (values (G_ "~Y-~m-~d") + (G_ "~Y-~m-~d"))))] ;; no end value, just return start [else (date->string s)]))] [else ; guaranteed datetime @@ -74,10 +74,10 @@ (e (prop ev 'DTEND))) (if e (let ((fmt-str (if (date= (get-date s) (get-date e)) - (_ "~H:~M") + (G_ "~H:~M") ;; Note the non-breaking space - (_ "~Y-~m-~d ~H:~M")))) + (G_ "~Y-~m-~d ~H:~M")))) (values fmt-str fmt-str)) ;; Note the non-breaking space - (_ "~Y-~m-~d ~H:~M")))])) + (G_ "~Y-~m-~d ~H:~M")))])) diff --git a/module/vcomponent/formats/common/types.scm b/module/vcomponent/formats/common/types.scm index a8a923da..fcb2b7b6 100644 --- a/module/vcomponent/formats/common/types.scm +++ b/module/vcomponent/formats/common/types.scm @@ -13,7 +13,7 @@ (define (parse-binary props value) ;; p 30 (unless (string=? "BASE64" (hashq-ref props 'ENCODING)) - (warning (_ "Binary field not marked ENCODING=BASE64"))) + (warning (G_ "Binary field not marked ENCODING=BASE64"))) ;; For icalendar no extra whitespace is allowed in a ;; binary field (except for line wrapping). This differs @@ -25,7 +25,7 @@ (cond [(string=? "TRUE" value) #t] [(string=? "FALSE" value) #f] - [else (warning (_ "~a invalid boolean") value)])) + [else (warning (G_ "~a invalid boolean") value)])) ;; CAL-ADDRESS ⇒ uri @@ -58,7 +58,7 @@ (define (parse-integer props value) (let ((n (string->number value))) (unless (integer? n) - (warning (_ "Non integer as integer"))) + (warning (G_ "Non integer as integer"))) n)) ;; PERIOD @@ -89,7 +89,7 @@ (case (cadr rem) [(#\n #\N) (loop (cddr rem) (cons #\newline str) done)] [(#\; #\, #\\) => (lambda (c) (loop (cddr rem) (cons c str) done))] - [else => (lambda (c) (warning (_ "Non-escapable character: ~a") c) + [else => (lambda (c) (warning (G_ "Non-escapable character: ~a") c) (loop (cddr rem) str done))])] [(#\,) (loop (cdr rem) '() (cons (reverse-list->string str) done))] @@ -138,5 +138,5 @@ (define (get-parser type) (or (hashq-ref type-parsers type #f) - (scm-error 'misc-error "get-parser" (_ "No parser for type ~a") + (scm-error 'misc-error "get-parser" (G_ "No parser for type ~a") (list type) #f))) diff --git a/module/vcomponent/formats/ical/output.scm b/module/vcomponent/formats/ical/output.scm index da891fa6..e4fad90a 100644 --- a/module/vcomponent/formats/ical/output.scm +++ b/module/vcomponent/formats/ical/output.scm @@ -96,7 +96,7 @@ (get-writer 'TEXT)] [else - (warning (_ "Unknown key ~a") key) + (warning (G_ "Unknown key ~a") key) (get-writer 'TEXT)])) (catch #t #; 'wrong-type-arg diff --git a/module/vcomponent/formats/ical/parse.scm b/module/vcomponent/formats/ical/parse.scm index 49f8f101..252a155e 100644 --- a/module/vcomponent/formats/ical/parse.scm +++ b/module/vcomponent/formats/ical/parse.scm @@ -14,6 +14,9 @@ :use-module (calp translation) :export (parse-calendar)) +;;; TODO a few translated strings here contain explicit newlines. Check if that +;;; is preserved through the translation. + (define string->symbol (let ((ht (make-hash-table 1000))) (lambda (str) @@ -124,7 +127,7 @@ (let ((vv (parser params value))) (when (list? vv) (scm-error 'parse-error "enum-parser" - (_ "List in enum field") + (G_ "List in enum field") #f #f)) (let ((v (string->symbol vv))) (unless (memv v enum) @@ -160,7 +163,7 @@ (lambda (params value) (let ((v ((get-parser 'TEXT) params value))) (unless (= 1 (length v)) - (warning (_ "List in non-list field: ~s") v)) + (warning (G_ "List in non-list field: ~s") v)) (string-join v ",")))] ;; TEXT, but allow a list @@ -198,7 +201,7 @@ [(memv key '(REQUEST-STATUS)) (scm-error 'parse-error "build-vline" - (_ "TODO Implement REQUEST-STATUS") + (G_ "TODO Implement REQUEST-STATUS") #f #f)] [(memv key '(ACTION)) @@ -233,7 +236,7 @@ (compose car (get-parser 'TEXT))] [else - (warning (_ "Unknown key ~a") key) + (warning (G_ "Unknown key ~a") key) (compose car (get-parser 'TEXT))]))) ;; If we produced a list create multiple VLINES from it. @@ -286,7 +289,7 @@ ;; ~? ;; source line ;; source file - (_ "WARNING parse error around ~a + (G_ "WARNING parse error around ~a ~? line ~a ~a~%") (get-string linedata) @@ -341,7 +344,7 @@ ;; ~? ;; source line ;; source file - (_ "ERROR parse error around ~a + (G_ "ERROR parse error around ~a ~? line ~a ~a Defaulting to string~%") diff --git a/module/vcomponent/formats/ical/types.scm b/module/vcomponent/formats/ical/types.scm index 7b6aad2e..768f5098 100644 --- a/module/vcomponent/formats/ical/types.scm +++ b/module/vcomponent/formats/ical/types.scm @@ -37,7 +37,7 @@ ;; TODO (define (write-period _ value) - (warning (_ "PERIOD writer not yet implemented")) + (warning (G_ "PERIOD writer not yet implemented")) (with-output-to-string (lambda () (write value)))) @@ -94,4 +94,4 @@ (define (get-writer type) (or (hashq-ref type-writers type #f) - (error (_ "No writer for type") type))) + (error (G_ "No writer for type") type))) diff --git a/module/vcomponent/formats/vdir/parse.scm b/module/vcomponent/formats/vdir/parse.scm index 46626402..4e21d4d0 100644 --- a/module/vcomponent/formats/vdir/parse.scm +++ b/module/vcomponent/formats/vdir/parse.scm @@ -64,7 +64,7 @@ ;; by RECURRENCE-ID. As far as I can tell this goes against ;; the standard. Section 3.8.4.4. (case (length events) - [(0) (warning (_ "No events in component~%~a") + [(0) (warning (G_ "No events in component~%~a") (prop item '-X-HNH-FILENAME))] [(1) (add-child! calendar (car events))] diff --git a/module/vcomponent/formats/vdir/save-delete.scm b/module/vcomponent/formats/vdir/save-delete.scm index ac520463..ab1985b6 100644 --- a/module/vcomponent/formats/vdir/save-delete.scm +++ b/module/vcomponent/formats/vdir/save-delete.scm @@ -26,16 +26,16 @@ (unless calendar (scm-error 'wrong-type-arg "save-event" - (_ "Can only save events belonging to calendars, event uid = ~s") + (G_ "Can only save events belonging to calendars, event uid = ~s") (list (prop event 'UID)) #f)) (unless (eq? 'vdir (prop calendar '-X-HNH-SOURCETYPE)) (scm-error 'wrong-type-arg "save-event" (string-append - (_ "Can only save events belonging to vdir calendars.") + (G_ "Can only save events belonging to vdir calendars.") " " - (_ "Calendar is of type ~s")) + (G_ "Calendar is of type ~s")) (list (prop calendar '-X-HNH-SOURCETYPE)) #f)) @@ -55,9 +55,9 @@ (define calendar (parent event)) (unless (eq? 'vdir (prop calendar '-X-HNH-SOURCETYPE)) (scm-error 'wrong-type-arg "remove-event" - (string-append (_ "Can only remove events belonging to vdir calendars.") + (string-append (G_ "Can only remove events belonging to vdir calendars.") " " - (_ "Calendar is of type ~s")) + (G_ "Calendar is of type ~s")) (list (prop calendar '-X-HNH-SOURCETYPE)) #f)) (delete-file (prop event '-X-HNH-FILENAME)) diff --git a/module/vcomponent/formats/xcal/output.scm b/module/vcomponent/formats/xcal/output.scm index 87ebd32b..8e92b280 100644 --- a/module/vcomponent/formats/xcal/output.scm +++ b/module/vcomponent/formats/xcal/output.scm @@ -70,7 +70,7 @@ (get-writer 'TEXT)] [else - (warning (_ "Unknown key ~a") key) + (warning (G_ "Unknown key ~a") key) (get-writer 'TEXT)])) (writer ((@@ (vcomponent base) get-vline-parameters) vline) (value vline))) diff --git a/module/vcomponent/formats/xcal/parse.scm b/module/vcomponent/formats/xcal/parse.scm index 8537956a..0e638d36 100644 --- a/module/vcomponent/formats/xcal/parse.scm +++ b/module/vcomponent/formats/xcal/parse.scm @@ -84,7 +84,7 @@ bymonth bysetpos) (string->number value)) (else (scm-error 'key-error "handle-value" - (_ "Invalid type ~a, with value ~a") + (G_ "Invalid type ~a, with value ~a") (list type value) #f)))))) @@ -157,7 +157,7 @@ (case tag-name [(request-status) ;; TODO - (warning (_ "Request status not yet implemented")) + (warning (G_ "Request status not yet implemented")) #f] ((transp) (parse-enum diff --git a/module/vcomponent/formats/xcal/types.scm b/module/vcomponent/formats/xcal/types.scm index a88b6b04..024ca61a 100644 --- a/module/vcomponent/formats/xcal/types.scm +++ b/module/vcomponent/formats/xcal/types.scm @@ -52,4 +52,4 @@ (define (get-writer type) (or (hashq-ref sxml-writers type #f) - (error (_ "No writer for type") type))) + (error (G_ "No writer for type") type))) diff --git a/module/vcomponent/util/instance.scm b/module/vcomponent/util/instance.scm index bf7f2226..2310c5bc 100644 --- a/module/vcomponent/util/instance.scm +++ b/module/vcomponent/util/instance.scm @@ -17,4 +17,4 @@ (define* (reload optional: (files ((@ (vcomponent config) calendar-files)))) (begin (set! global-event-object (make-instance files)) - (format (current-error-port) (_ "Reload done~%")))) + (format (current-error-port) (G_ "Reload done~%")))) diff --git a/module/vcomponent/util/instance/methods.scm b/module/vcomponent/util/instance/methods.scm index 193a0304..f6c56cb9 100644 --- a/module/vcomponent/util/instance/methods.scm +++ b/module/vcomponent/util/instance/methods.scm @@ -80,7 +80,7 @@ (define-method (initialize (this ) args) (next-method) - (format (current-error-port) (_ "Building from~%")) + (format (current-error-port) (G_ "Building from~%")) (for calendar in (slot-ref this 'calendar-files) (format (current-error-port) " - ~a~%" calendar)) @@ -196,13 +196,13 @@ ;; save-event sets -X-HNH-FILENAME from the UID. This is fine ;; since the two events are guaranteed to have the same UID. (unless ((@ (vcomponent formats vdir save-delete) save-event) event) - (throw 'misc-error (_ "Saving event to disk failed."))) + (throw 'misc-error (G_ "Saving event to disk failed."))) (unless (eq? calendar (parent old-event)) ;; change to a new calendar (format (current-error-port) - (_ "Unlinking old event from ~a~%") + (G_ "Unlinking old event from ~a~%") (prop old-event '-X-HNH-FILENAME)) ;; NOTE that this may fail, leading to a duplicate event being ;; created (since we save beforehand). This is just a minor problem @@ -212,7 +212,7 @@ (format (current-error-port) - (_ "Event updated ~a~%") (prop event 'UID)))] + (G_ "Event updated ~a~%") (prop event 'UID)))] [else (add-event this calendar event) @@ -222,7 +222,7 @@ ;; NOTE Posibly defer save to a later point. ;; That would allow better asyncronous preformance. (unless ((@ (vcomponent formats vdir save-delete) save-event) event) - (throw 'misc-error (_ "Saving event to disk failed."))) + (throw 'misc-error (G_ "Saving event to disk failed."))) (format (current-error-port) - (_ "Event inserted ~a~%") (prop event 'UID))])) + (G_ "Event inserted ~a~%") (prop event 'UID))])) diff --git a/module/vcomponent/util/parse-cal-path.scm b/module/vcomponent/util/parse-cal-path.scm index cf03db88..24eee04e 100644 --- a/module/vcomponent/util/parse-cal-path.scm +++ b/module/vcomponent/util/parse-cal-path.scm @@ -21,14 +21,14 @@ (set! (prop comp '-X-HNH-SOURCETYPE) 'file) comp) ] [(directory) - (report-time! (_ "Parsing ~a") path) + (report-time! (G_ "Parsing ~a") path) (let ((comp (parse-vdir path))) (set! (prop comp '-X-HNH-SOURCETYPE) 'vdir (prop comp '-X-HNH-DIRECTORY) path) comp)] [(block-special char-special fifo socket unknown symlink) => (lambda (t) (scm-error 'misc-error "parse-cal-path" - (_ "Can't parse file of type ~s") + (G_ "Can't parse file of type ~s") (list t) #f))])) diff --git a/tests/test/html/caltable.scm b/tests/test/html/caltable.scm index f64f8775..fec1ace4 100644 --- a/tests/test/html/caltable.scm +++ b/tests/test/html/caltable.scm @@ -11,7 +11,7 @@ ;; Not the most robust test, but at least it shows us when we break something (test-equal "Whole fucking caltable" `(div (@ (class "small-calendar")) - (div (@ (class "column-head row-head")) ,(_ "v.")) + (div (@ (class "column-head row-head")) ,(G_ "v.")) (div (@ (class "column-head")) "Må") (div (@ (class "column-head")) "Ti") (div (@ (class "column-head")) "On") -- cgit v1.2.3