diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-04-11 19:03:45 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-04-11 19:12:30 +0200 |
commit | 79d59e0b333966e0dd978a72e74a81b9ea1f9db6 (patch) | |
tree | ca2b171fdeb43863d9dfbafb9a66291adf77362c | |
parent | split (all-modules) into two procedures. (diff) | |
download | calp-79d59e0b333966e0dd978a72e74a81b9ea1f9db6.tar.gz calp-79d59e0b333966e0dd978a72e74a81b9ea1f9db6.tar.xz |
Allow translation of non-extracted strings.
Diffstat (limited to '')
-rw-r--r-- | module/calp/translation.scm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/module/calp/translation.scm b/module/calp/translation.scm index c0392d95..77c947da 100644 --- a/module/calp/translation.scm +++ b/module/calp/translation.scm @@ -2,16 +2,23 @@ :use-module (ice-9 i18n) :use-module (ice-9 regex) :use-module (ice-9 match) - :export (_ yes-no-check)) + :export (_ translate yes-no-check)) (bindtextdomain "calp" "/home/hugo/code/calp/localization/") -(define (_ . msg) + +;; Translate string, but doesn't mark it for translation. +;; Used (at least) for get-config introspection procedures. +(define (translate string) ;; NOTE this doesn't squeese repeated whitespace (string-map (match-lambda (#\newline #\space) (c c)) - (gettext (string-join msg) "calp"))) + (gettext string "calp"))) + +;; Mark string for translation, and also make it discoverable for gettext +(define (_ . msg) + (translate (string-join msg))) (define* (yes-no-check string #:optional (locale %global-locale)) (cond ((string-match (locale-yes-regexp locale) string) 'yes) |