aboutsummaryrefslogtreecommitdiff
path: root/module/datetime
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-02-22 11:19:19 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-02-22 21:08:41 +0100
commit093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee (patch)
treed164e37c20e562588700d86379cfda1b0ca3c596 /module/datetime
parentDatetime restrict imports. (diff)
downloadcalp-093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee.tar.gz
calp-093ef72e6489d96fb6ffae8d58d7cb1cb7ff77ee.tar.xz
Prepare code for translation.
Diffstat (limited to 'module/datetime')
-rw-r--r--module/datetime/instance.scm5
-rw-r--r--module/datetime/timespec.scm3
-rw-r--r--module/datetime/zic.scm20
3 files changed, 16 insertions, 12 deletions
diff --git a/module/datetime/instance.scm b/module/datetime/instance.scm
index 5ce312f2..2b060204 100644
--- a/module/datetime/instance.scm
+++ b/module/datetime/instance.scm
@@ -5,10 +5,11 @@
:use-module ((hnh util path) :select (path-append))
:use-module (datetime zic)
:use-module ((xdg basedir) :prefix xdg-)
+ :use-module (calp translation)
:export (zoneinfo))
(define-config tz-list '()
- description: "List of default zoneinfo files to be parsed")
+ description: (_ "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
@@ -24,7 +25,7 @@
(()
(define tz-list (get-config 'tz-list))
(if (null? tz-list)
- (warning "Default zoneinfo only available when tz-dir and tz-list are configured")
+ (warning (_ "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 712ff327..ea29a423 100644
--- a/module/datetime/timespec.scm
+++ b/module/datetime/timespec.scm
@@ -11,6 +11,7 @@
:use-module (datetime)
:use-module (srfi srfi-1)
:use-module (srfi srfi-9 gnu)
+ :use-module (calp translation)
)
@@ -33,7 +34,7 @@
(define-public (timespec-add . specs)
(unless (apply eqv? (map timespec-type specs))
- (warning "Adding timespecs of differing types"))
+ (warning (_ "Adding timespecs of differing types")))
(reduce (lambda (spec done)
(cond
diff --git a/module/datetime/zic.scm b/module/datetime/zic.scm
index b07c2bfa..0362ec99 100644
--- a/module/datetime/zic.scm
+++ b/module/datetime/zic.scm
@@ -22,6 +22,7 @@
:use-module (srfi srfi-9 gnu)
:use-module ((vcomponent recurrence internal)
:select (byday make-recur-rule bymonthday))
+ :use-module (calp translation)
)
@@ -162,7 +163,7 @@
day: (string->number day))
time: (timespec-time timespec)
tz: (case (timespec-type timespec)
- [(#\s) (warning "what even is \"Standard time\"‽") ""]
+ [(#\s) (warning (_ "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.
@@ -258,8 +259,8 @@
;; NOTE an earlier version of the code the parsers for those.
;; They were removed since they were unused, uneeded, and was
;; technical dept.
- (error "Invalid key ~a. Note that leap seconds and
-expries rules aren't yet implemented." type)]
+ (error (_ "Invalid key ~a. Note that leap seconds and
+expries rules aren't yet implemented.") type)]
))]))))))
@@ -295,7 +296,7 @@ expries rules aren't yet implemented." type)]
(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 (_ "Unresolved link, target missing ~a -> ~a") name target)
(hash-set! zones name target-item))))
(car it)))
@@ -335,7 +336,7 @@ expries rules aren't yet implemented." type)]
(set (day d) base-day)))]))
tz: (case (timespec-type (rule-at rule))
((#\w) #f)
- ((#\s) (warning "what even is \"Standard time\"‽") #f)
+ ((#\s) (warning (_ "what even is \"Standard time\"‽")) #f)
((#\u #\g #\z) 'UTC))))
(let ((timespec (rule-at rule)))
@@ -356,7 +357,7 @@ expries rules aren't yet implemented." type)]
until: (let ((to (rule-to rule)))
(case to
((maximum) #f)
- ((minimum) (error "Check your input"))
+ ((minimum) (error (_ "Check your input")))
((only)
(datetime
date: (date year: (rule-from rule) month: 1 day: 1)))
@@ -380,7 +381,7 @@ expries rules aren't yet implemented." type)]
;; Sun>=8
(let* (((<> wday base-day) (rule-on rule)))
(when (eq? '< <>)
- (warning "Counting backward for RRULES unsupported"))
+ (warning (_ "Counting backward for RRULES unsupported")))
;; NOTE this only realy works when base-day = 7n + 1, n ∈ N
;; something like Sun>=5 is hard to fix, since we can only
;; say which sunday in the month we want (first sunday,
@@ -398,7 +399,8 @@ expries rules aren't yet implemented." type)]
idx (+ idx 2))]
[(#\z)
;; NOTE No zones seem to currently use %z formatting.
- (warning "%z not yet implemented")
+ ;; '%z' is NOT a format string, but information about another format string.
+ (warning (_ "%z not yet implemented"))
fmt-string]
- [else (error "Invalid format char")])))
+ [else (error (_ "Invalid format char"))])))