aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/formats/ical
diff options
context:
space:
mode:
Diffstat (limited to 'module/vcomponent/formats/ical')
-rw-r--r--module/vcomponent/formats/ical/output.scm11
-rw-r--r--module/vcomponent/formats/ical/parse.scm17
-rw-r--r--module/vcomponent/formats/ical/types.scm4
3 files changed, 17 insertions, 15 deletions
diff --git a/module/vcomponent/formats/ical/output.scm b/module/vcomponent/formats/ical/output.scm
index da891fa6..57860d2a 100644
--- a/module/vcomponent/formats/ical/output.scm
+++ b/module/vcomponent/formats/ical/output.scm
@@ -16,6 +16,7 @@
:use-module (vcomponent geo)
:use-module (vcomponent formats ical types)
:use-module (vcomponent recurrence)
+ :use-module ((calp) :select (prodid))
:use-module (calp translation)
:autoload (vcomponent util instance) (global-event-object)
:export (component->ical-string
@@ -24,10 +25,6 @@
print-events-in-interval
))
-(define (prodid)
- (format #f "-//hugo//calp ~a//EN"
- (@ (calp) version)))
-
;; Format value depending on key type.
;; Should NOT emit the key.
@@ -96,7 +93,7 @@
(get-writer 'TEXT)]
[else
- (warning (_ "Unknown key ~a") key)
+ (warning (G_ "Unknown key ~a") key)
(get-writer 'TEXT)]))
(catch #t #; 'wrong-type-arg
@@ -168,7 +165,9 @@
;; If we have alternatives, splice them in here.
(cond [(prop component '-X-HNH-ALTERNATIVES)
- => (lambda (alts) (hash-map->list (lambda (_ comp) (component->ical-string comp))
+ => (lambda (alts) (hash-map->list (lambda (_ comp)
+ (unless (eq? component comp)
+ (component->ical-string comp)))
alts))]))
diff --git a/module/vcomponent/formats/ical/parse.scm b/module/vcomponent/formats/ical/parse.scm
index 49f8f101..f0a19ba5 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)
@@ -303,7 +306,7 @@
(if (null? (cdr stack))
;; return
(car stack)
- (begin (add-child! (cadr stack) (car stack))
+ (begin (reparent! (cadr stack) (car stack))
(cdr stack))))]
[else
(let ((key value params (parse-itemline head)))
@@ -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)))