diff options
Diffstat (limited to 'module/vcomponent/formats')
-rw-r--r-- | module/vcomponent/formats/common/types.scm | 11 | ||||
-rw-r--r-- | module/vcomponent/formats/ical/output.scm | 3 | ||||
-rw-r--r-- | module/vcomponent/formats/ical/parse.scm | 29 | ||||
-rw-r--r-- | module/vcomponent/formats/ical/types.scm | 8 | ||||
-rw-r--r-- | module/vcomponent/formats/vdir/parse.scm | 3 | ||||
-rw-r--r-- | module/vcomponent/formats/vdir/save-delete.scm | 6 | ||||
-rw-r--r-- | module/vcomponent/formats/xcal/output.scm | 3 | ||||
-rw-r--r-- | module/vcomponent/formats/xcal/parse.scm | 5 | ||||
-rw-r--r-- | module/vcomponent/formats/xcal/types.scm | 3 |
9 files changed, 46 insertions, 25 deletions
diff --git a/module/vcomponent/formats/common/types.scm b/module/vcomponent/formats/common/types.scm index 97980e1a..9e18f1eb 100644 --- a/module/vcomponent/formats/common/types.scm +++ b/module/vcomponent/formats/common/types.scm @@ -5,13 +5,14 @@ :use-module (datetime) :use-module (srfi srfi-9 gnu) :use-module (datetime timespec) + :use-module (calp translation) ) ;; BINARY (define (parse-binary props value) ;; p 30 (unless (string=? "BASE64" (hashq-ref props 'ENCODING)) - (warning "Binary field not marked ENCODING=BASE64")) + (warning (_ "Binary field not marked ENCODING=BASE64"))) ;; For icalendar no extra whitespace is allowed in a ;; binary field (except for line wrapping). This differs @@ -23,7 +24,7 @@ (cond [(string=? "TRUE" value) #t] [(string=? "FALSE" value) #f] - [else (warning "~a invalid boolean" value)])) + [else (warning (_ "~a invalid boolean") value)])) ;; CAL-ADDRESS ⇒ uri @@ -56,7 +57,7 @@ (define (parse-integer props value) (let ((n (string->number value))) (unless (integer? n) - (warning "Non integer as integer")) + (warning (_ "Non integer as integer"))) n)) ;; PERIOD @@ -87,7 +88,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 (_ "Non-escapable character: ~a") c) (loop (cddr rem) str done))])] [(#\,) (loop (cdr rem) '() (cons (reverse-list->string str) done))] @@ -136,5 +137,5 @@ (define-public (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" (_ "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 fba8bffc..489cdc00 100644 --- a/module/vcomponent/formats/ical/output.scm +++ b/module/vcomponent/formats/ical/output.scm @@ -15,6 +15,7 @@ :use-module (vcomponent geo) :use-module (vcomponent formats ical types) :use-module (vcomponent recurrence) + :use-module (calp translation) :autoload (vcomponent util instance) (global-event-object) ) @@ -90,7 +91,7 @@ (get-writer 'TEXT)] [else - (warning "Unknown key ~a" key) + (warning (_ "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 08f31ae7..7f6c89cc 100644 --- a/module/vcomponent/formats/ical/parse.scm +++ b/module/vcomponent/formats/ical/parse.scm @@ -10,6 +10,7 @@ :use-module (vcomponent base) :use-module (vcomponent geo) :use-module (vcomponent formats common types) + :use-module (calp translation) ) (define string->symbol @@ -122,7 +123,7 @@ (let ((vv (parser params value))) (when (list? vv) (scm-error 'parse-error "enum-parser" - "List in enum field" + (_ "List in enum field") #f #f)) (let ((v (string->symbol vv))) (unless (memv v enum) @@ -158,7 +159,7 @@ (lambda (params value) (let ((v ((get-parser 'TEXT) params value))) (unless (= 1 (length v)) - (warning "List in non-list field: ~s" v)) + (warning (_ "List in non-list field: ~s") v)) (string-join v ",")))] ;; TEXT, but allow a list @@ -196,7 +197,7 @@ [(memv key '(REQUEST-STATUS)) (scm-error 'parse-error "build-vline" - "TODO Implement REQUEST-STATUS" + (_ "TODO Implement REQUEST-STATUS") #f #f)] [(memv key '(ACTION)) @@ -231,7 +232,7 @@ (compose car (get-parser 'TEXT))] [else - (warning "Unknown key ~a" key) + (warning (_ "Unknown key ~a") key) (compose car (get-parser 'TEXT))]))) ;; If we produced a list create multiple VLINES from it. @@ -278,9 +279,15 @@ (lambda (fmt . args) (let ((linedata (get-metadata head*))) (format - #f "WARNING parse error around ~a + #f + ;; arguments: + ;; linedata + ;; ~? + ;; source line + ;; source file + (_ "WARNING parse error around ~a ~? - line ~a ~a~%" + line ~a ~a~%") (get-string linedata) fmt args (get-line linedata) @@ -326,10 +333,16 @@ (lambda (err proc fmt fmt-args data) (let ((linedata (get-metadata head*))) (display (format - #f "ERROR parse error around ~a + #f + ;; arguments + ;; linedata + ;; ~? + ;; source line + ;; source file + (_ "ERROR parse error around ~a ~? line ~a ~a - Defaulting to string~%" + Defaulting to string~%") (get-string linedata) fmt fmt-args (get-line linedata) diff --git a/module/vcomponent/formats/ical/types.scm b/module/vcomponent/formats/ical/types.scm index 39b3b1e3..67f9f633 100644 --- a/module/vcomponent/formats/ical/types.scm +++ b/module/vcomponent/formats/ical/types.scm @@ -4,7 +4,9 @@ :use-module (hnh util exceptions) :use-module (base64) :use-module (datetime) - :use-module (datetime timespec)) + :use-module (datetime timespec) + :use-module (calp translation) + ) ;; TODO shouldn't these really take vline:s? @@ -35,7 +37,7 @@ ;; TODO (define (write-period _ value) - (warning "PERIOD writer not yet implemented") + (warning (_ "PERIOD writer not yet implemented")) (with-output-to-string (lambda () (write value)))) @@ -92,4 +94,4 @@ (define-public (get-writer type) (or (hashq-ref type-writers type #f) - (error "No writer for type" type))) + (error (_ "No writer for type") type))) diff --git a/module/vcomponent/formats/vdir/parse.scm b/module/vcomponent/formats/vdir/parse.scm index 272674ed..b21a5f2b 100644 --- a/module/vcomponent/formats/vdir/parse.scm +++ b/module/vcomponent/formats/vdir/parse.scm @@ -15,6 +15,7 @@ :use-module ((hnh util path) :select (path-append)) :use-module (hnh util exceptions) :use-module (vcomponent base) + :use-module (calp translation) :use-module (vcomponent formats ical parse) ) @@ -62,7 +63,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 (_ "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 96354ce8..01d34f9f 100644 --- a/module/vcomponent/formats/vdir/save-delete.scm +++ b/module/vcomponent/formats/vdir/save-delete.scm @@ -24,13 +24,13 @@ (unless calendar (scm-error 'wrong-type-arg "save-event" - "Can only save events belonging to calendars, event uid = ~s" + (_ "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" - "Can only save events belonging to vdir calendars. Calendar is of type ~s" + (_ "Can only save events belonging to vdir calendars. Calendar is of type ~s") (list (prop calendar '-X-HNH-SOURCETYPE)) #f)) @@ -50,7 +50,7 @@ (define calendar (parent event)) (unless (eq? 'vdir (prop calendar '-X-HNH-SOURCETYPE)) (scm-error 'wrong-type-arg "remove-event" - "Can only remove events belonging to vdir calendars. Calendar is of type ~s" + (_ "Can only remove events belonging to vdir calendars. 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 81fab41c..26018d92 100644 --- a/module/vcomponent/formats/xcal/output.scm +++ b/module/vcomponent/formats/xcal/output.scm @@ -7,6 +7,7 @@ :use-module (ice-9 match) :use-module (datetime) :use-module (srfi srfi-1) + :use-module (calp translation) ) @@ -69,7 +70,7 @@ (get-writer 'TEXT)] [else - (warning "Unknown key ~a" key) + (warning (_ "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 b21e72b5..d9020858 100644 --- a/module/vcomponent/formats/xcal/parse.scm +++ b/module/vcomponent/formats/xcal/parse.scm @@ -9,6 +9,7 @@ :use-module (vcomponent formats common types) :use-module (datetime) :use-module (srfi srfi-1) + :use-module (calp translation) ) ;; symbol, ht, (list a) -> non-list @@ -82,7 +83,7 @@ bymonth bysetpos) (string->number value)) (else (scm-error 'key-error "handle-value" - "Invalid type ~a, with value ~a" + (_ "Invalid type ~a, with value ~a") (list type value) #f)))))) @@ -155,7 +156,7 @@ (case tag-name [(request-status) ;; TODO - (warning "Request status not yet implemented") + (warning (_ "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 05fbc8c6..8f13d3d1 100644 --- a/module/vcomponent/formats/xcal/types.scm +++ b/module/vcomponent/formats/xcal/types.scm @@ -2,6 +2,7 @@ :use-module (hnh util) :use-module (vcomponent formats ical types) :use-module (datetime) + :use-module (calp translation) ) (define (write-boolean _ v) @@ -51,4 +52,4 @@ (define-public (get-writer type) (or (hashq-ref sxml-writers type #f) - (error "No writer for type" type))) + (error (_ "No writer for type") type))) |