aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-10-14 21:08:16 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-10-16 23:28:34 +0200
commit78fd74622dca5f2def261506c3f8d4c0a940a6c4 (patch)
tree87b8362454c759b680fe566229b5adbc3f25e712 /module/vcomponent
parentChange NOTE to TODO. (diff)
downloadcalp-78fd74622dca5f2def261506c3f8d4c0a940a6c4.tar.gz
calp-78fd74622dca5f2def261506c3f8d4c0a940a6c4.tar.xz
Change gettext '_' to 'G_'.
Guile 3 reserves _ for other stuff.
Diffstat (limited to 'module/vcomponent')
-rw-r--r--module/vcomponent/config.scm4
-rw-r--r--module/vcomponent/control.scm2
-rw-r--r--module/vcomponent/datetime/output.scm24
-rw-r--r--module/vcomponent/formats/common/types.scm10
-rw-r--r--module/vcomponent/formats/ical/output.scm2
-rw-r--r--module/vcomponent/formats/ical/parse.scm15
-rw-r--r--module/vcomponent/formats/ical/types.scm4
-rw-r--r--module/vcomponent/formats/vdir/parse.scm2
-rw-r--r--module/vcomponent/formats/vdir/save-delete.scm10
-rw-r--r--module/vcomponent/formats/xcal/output.scm2
-rw-r--r--module/vcomponent/formats/xcal/parse.scm4
-rw-r--r--module/vcomponent/formats/xcal/types.scm2
-rw-r--r--module/vcomponent/util/instance.scm2
-rw-r--r--module/vcomponent/util/instance/methods.scm12
-rw-r--r--module/vcomponent/util/parse-cal-path.scm4
15 files changed, 51 insertions, 48 deletions
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 <events>) args)
(next-method)
- (format (current-error-port) (_ "Building <events> from~%"))
+ (format (current-error-port) (G_ "Building <events> 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))]))