[cl-l10n-cvs] CVS update: cl-l10n/ChangeLog cl-l10n/cl-l10n.asd cl-l10n/load-locale.lisp cl-l10n/printers.lisp cl-l10n/tests.lisp
Sean Ross
sross at common-lisp.net
Tue Feb 1 07:58:27 UTC 2005
Update of /project/cl-l10n/cvsroot/cl-l10n
In directory common-lisp.net:/tmp/cvs-serv7773
Modified Files:
ChangeLog cl-l10n.asd load-locale.lisp printers.lisp
tests.lisp
Log Message:
Changelog 2005-02-01
Date: Mon Jan 31 23:58:25 2005
Author: sross
Index: cl-l10n/ChangeLog
diff -u cl-l10n/ChangeLog:1.9 cl-l10n/ChangeLog:1.10
--- cl-l10n/ChangeLog:1.9 Tue Jan 4 07:32:15 2005
+++ cl-l10n/ChangeLog Mon Jan 31 23:58:25 2005
@@ -1,3 +1,8 @@
+2005-02-01 Sean Ross <sross at common-lisp.net>
+ * load-locale.lisp: Revert to a default thousands separator
+ if the the locale to be loaded doesn't have one.
+ * printers.lisp: Fixed bug in float padding.
+
2005-01-04 Sean Ross <sross at common-lisp.net>
* locale.lisp: Changed get-category, get-locale to generic-functions
Changed macro get-cat-val to method category-value.
Index: cl-l10n/cl-l10n.asd
diff -u cl-l10n/cl-l10n.asd:1.7 cl-l10n/cl-l10n.asd:1.8
--- cl-l10n/cl-l10n.asd:1.7 Thu Dec 30 03:56:38 2004
+++ cl-l10n/cl-l10n.asd Mon Jan 31 23:58:25 2005
@@ -11,7 +11,7 @@
:name "CL-L10N"
:author "Sean Ross <sdr at jhb.ucs.co.za>"
:maintainer "Sean Ross <sdr at jhb.ucs.co.za>"
- :version "0.2.0"
+ :version "0.2.2"
:description "Portable CL Locale Support"
:long-description "Portable CL Package to support localization"
:licence "MIT"
Index: cl-l10n/load-locale.lisp
diff -u cl-l10n/load-locale.lisp:1.8 cl-l10n/load-locale.lisp:1.9
--- cl-l10n/load-locale.lisp:1.8 Tue Jan 4 07:32:15 2005
+++ cl-l10n/load-locale.lisp Mon Jan 31 23:58:25 2005
@@ -70,9 +70,16 @@
(handler-case (load-locale (pathname-name x))
(locale-error (c) (warn "Unable to load locale ~A. ~%~A." x c))))))))
+(defvar *default-thousands-sep* #\,)
+
+(defun thousands-sep-char (sep)
+ (if (> (length sep) 0)
+ (schar sep 0)
+ *default-thousands-sep*))
(defun create-number-fmt-string (locale no-ts)
- (cl:format nil "~~A~~,,'~A,~A~A~~{~~A~~}" (schar (locale-thousands-sep locale) 0)
+ (cl:format nil "~~A~~,,'~A,~A~A~~{~~A~~}"
+ (thousands-sep-char (locale-thousands-sep locale))
(locale-grouping locale)
(if no-ts "D" ":D")))
@@ -103,7 +110,7 @@
(princ sym-sep stream))
;; Actual number
(cl:format stream "~~,,'~A,~A~A~~{~~A~~}"
- (schar (locale-mon-thousands-sep locale) 0)
+ (thousands-sep-char (locale-mon-thousands-sep locale))
(locale-mon-grouping locale)
(if no-ts "D" ":D"))
(unless prec
Index: cl-l10n/printers.lisp
diff -u cl-l10n/printers.lisp:1.8 cl-l10n/printers.lisp:1.9
--- cl-l10n/printers.lisp:1.8 Tue Jan 4 07:32:15 2005
+++ cl-l10n/printers.lisp Mon Jan 31 23:58:25 2005
@@ -1,4 +1,4 @@
-;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
;; See the file LICENCE for licence information.
(in-package :cl-l10n)
@@ -13,9 +13,12 @@
determine the number of zero's to print")
(defun fix-float-string (string size)
- (if (string= string "")
- (make-string size :initial-element #\0)
- string))
+ "Pads the string with trailing zero's if it is smaller than size"
+ (with-output-to-string (s)
+ (princ string s)
+ (when (< (length string) size)
+ (dotimes (x (- size (length string)))
+ (princ "0" s)))))
(defun format-number (stream arg no-dp no-ts
&optional (locale *locale*))
Index: cl-l10n/tests.lisp
diff -u cl-l10n/tests.lisp:1.4 cl-l10n/tests.lisp:1.5
--- cl-l10n/tests.lisp:1.4 Thu Dec 30 03:56:38 2004
+++ cl-l10n/tests.lisp Mon Jan 31 23:58:25 2005
@@ -35,7 +35,7 @@
(deftest number.6
(format nil "~v:/cl-l10n:format-number/" "sv_SE" 1/2)
- "0,5")
+ "0,50")
(deftest number.7
(format nil "~v:/cl-l10n:format-number/" "en_GB" 100.12312d0)
More information about the Cl-l10n-cvs
mailing list