summaryrefslogtreecommitdiff
path: root/modules/language/python/module/locale.scm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/language/python/module/locale.scm')
-rw-r--r--modules/language/python/module/locale.scm60
1 files changed, 30 insertions, 30 deletions
diff --git a/modules/language/python/module/locale.scm b/modules/language/python/module/locale.scm
index 5ed77f1..ed89724 100644
--- a/modules/language/python/module/locale.scm
+++ b/modules/language/python/module/locale.scm
@@ -1,5 +1,5 @@
(define-module (language python module locale)
- ;#:use-module (language python module re)
+ #:use-module (language python module re)
#:use-module (language python module sys)
#:use-module (language python module os)
#:use-module (language python list)
@@ -258,7 +258,7 @@ maps them to values suitable for passing to the C lib's setlocale() function.
(lambda (rpos amount)
(pylist-slice s lpos (+ rpos 1) None)))))))
-#;
+
(define _percent_re (compile (+ "%(?:\\((?P<key>.*?)\\))?"
"(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]")))
@@ -278,41 +278,41 @@ maps them to values suitable for passing to the C lib's setlocale() function.
(define _format
(lam (percent value (= grouping #f) (= monetary #f) (* additional))
- (let ((formated (py-apply py-mod percent
- (* (if additional
- (+ (list value) additional)
- (list value))))))
+ (let ((formated (py-mod percent
+ (if additional
+ (+ (list value) additional)
+ (list value)))))
;; floats and decimal ints need special action!
(when (in (pylist-ref percent -1) "eEfFgG")
- (let ((seps 0)
- (parts (py-split formated ".")))
- (when grouping
- (call-with-values
- (lambda () (_group (pylist-ref parts 0) #:monetary monetary))
- (lambda (p s)
- (pylist-set! parts 0 p)
- (set! seps s))))
-
- (let ((decimal_point (pylist-ref (localeconv)
- (or (and (bool monetary) "mon_decimal_point")
- "decimal_point"))))
- (set! formated (py-join decimal_point parts))
- (when (bool seps)
- (set! formated (_strip_padding formated seps))))))
+ (let ((seps 0)
+ (parts (py-split formated ".")))
+ (when grouping
+ (call-with-values
+ (lambda () (_group (pylist-ref parts 0) #:monetary monetary))
+ (lambda (p s)
+ (pylist-set! parts 0 p)
+ (set! seps s))))
+
+ (let ((decimal_point (pylist-ref (localeconv)
+ (or (and (bool monetary) "mon_decimal_point")
+ "decimal_point"))))
+ (set! formated (py-join decimal_point parts))
+ (when (bool seps)
+ (set! formated (_strip_padding formated seps))))))
- (when (in (pylist-ref percent -1) "diu")
- (let ((seps 0))
- (when grouping
- (call-with-values
- (lambda () (_group formated #:monetary monetary))
- (lambda (p s)
+ (when (in (pylist-ref percent -1) "diu")
+ (let ((seps 0))
+ (when grouping
+ (call-with-values
+ (lambda () (_group formated #:monetary monetary))
+ (lambda (p s)
(set! formated p)
(set! seps s))))
- (when (bool seps)
- (set! formated (_strip_padding formated seps)))))
+ (when (bool seps)
+ (set! formated (_strip_padding formated seps)))))
- formated)))
+ formated)))
(define format_string
(lam (f val (= grouping #f))