diff options
Diffstat (limited to 'module/calp/translation.scm')
-rw-r--r-- | module/calp/translation.scm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/module/calp/translation.scm b/module/calp/translation.scm new file mode 100644 index 00000000..c0392d95 --- /dev/null +++ b/module/calp/translation.scm @@ -0,0 +1,20 @@ +(define-module (calp translation) + :use-module (ice-9 i18n) + :use-module (ice-9 regex) + :use-module (ice-9 match) + :export (_ yes-no-check)) + +(bindtextdomain "calp" "/home/hugo/code/calp/localization/") + +(define (_ . msg) + ;; NOTE this doesn't squeese repeated whitespace + (string-map (match-lambda + (#\newline #\space) + (c c)) + (gettext (string-join msg) "calp"))) + +(define* (yes-no-check string #:optional (locale %global-locale)) + (cond ((string-match (locale-yes-regexp locale) string) 'yes) + ((string-match (locale-no-regexp locale) string) 'no) + (else #f))) + |