Update of /project/cl-l10n/cvsroot/cl-l10n/doc In directory common-lisp.net:/tmp/cvs-serv9854/doc
Modified Files: cl-l10n.texi Log Message: Changelog 2004-12-08 Date: Wed Dec 8 11:02:29 2004 Author: sross
Index: cl-l10n/doc/cl-l10n.texi diff -u cl-l10n/doc/cl-l10n.texi:1.2 cl-l10n/doc/cl-l10n.texi:1.3 --- cl-l10n/doc/cl-l10n.texi:1.2 Wed Dec 1 12:48:46 2004 +++ cl-l10n/doc/cl-l10n.texi Wed Dec 8 11:02:28 2004 @@ -77,7 +77,7 @@ various accessors (like locale-mon), number printing, money printing and time/date printing.
-The CL-L10n Home Page is at @uref{http://www.common-lisp.net/project/cl-l10n%7D +The CL-L10N Home Page is at @uref{http://www.common-lisp.net/project/cl-l10n%7D where one can find details about mailing lists, cvs repositories and various releases.
Enjoy @@ -89,6 +89,7 @@ @item CMUCL @item CLISP @item Lispworks +@item ECL @end itemize
@@ -104,7 +105,7 @@ @section Downloading @itemize @item ASDF-INSTALL -CL-L10n is available through asdf-install. If you are new +CL-L10N is available through asdf-install. If you are new to Common Lisp this is the suggested download method. With asdf-install loaded run @lisp (asdf-install:install :cl-l10n) @end lisp This will download and install the package for you. Asdf-install will try to verify @@ -130,7 +131,7 @@ @section Installing Once downloaded and symlinked you can load CL-L10N at anytime using @code{(asdf:oos 'asdf:load-op :cl-l10n)} -This will compile CL-L10n the first time it is loaded. +This will compile CL-L10N the first time it is loaded.
Once installed run @code{(asdf:oos 'asdf:test-op :cl-l10n)} to test the package. If any tests fail please send an email to one of the @@ -237,14 +238,26 @@ @anchor {Function format-time} @deffn {function} format-time stream ut show-date show-time &optional (locale *locale*) fmt Prints the @code{universal-time} @emph{ut} as a locale specific time to @emph{stream}. -The format of the time printed is controlled by @code{show-time} and @code{show-date}. +The format of the time printed is controlled by @emph{show-time} and @emph{show-date}. + +@table @code +@item show-time and show-date are not nil +@code{locale-d-t-fmt} +@item show-time and show-date are nil +@code{locale-t-fmt-ampm} or @code{locale-t-fmt} if @code{locale-t-fmt-ampm} has +no apparent value. +@item show-time is not nil and show-date is nil +locale-t-fmt +@item show-date is not nil and show-time is nil +locale-d-fmt +@end table
If @emph{fmt} is not nil then @emph{show-date} and @emph{show-time} are ignored and @emph{fmt} is used as the format control string. For details of format directive look at 'man 1 date' although some directives are not supported, namely %U, %V and %W.
Examples (assuming *locale* is ``en_ZA'') -@lisp +@verbatim (format t "~:/cl-l10n:format-time/" 3192624000) prints `03/03/01'
@@ -252,16 +265,54 @@ prints `18:00:00'
(format t "~:@/cl-l10n:format-time/" 3192624000) - prints `Sat 03 Mar 2001 18:00:00 -2' + prints `Sat 03 Mar 2001 18:00:00 +0200'
(format t "~v,v/cl-l10n:format-time/" "fr_FR" "%A" 3192624000) prints `samedi'
(format t "~,v/cl-l10n:format-time/" "%A" 3192624000) prints `Saturday' -@end lisp +@end verbatim +@end deffn + +@anchor {Function format} +@deffn {Function} format stream fmt-string &rest args +Format is an unexported symbol in the cl-l10n package. It's +use is to make formatting of dates, times, numbers and monetary +values simpler. +Shadow importing @code{cl-l10::format} into your package gives +you a few new format directives. +The new directives are ~U : Time and Date (universal-time), +~N : Numbers and ~M : Monetary values. All other format directives +are unchanged and work as normal. These new directives are +drop in replacements for the ~/cl-l10n:format-?/ calls. + +@verbatim +;; These examples assume an en_ZA locale +(in-package :cl-user) + +(shadowing-import 'cl-l10n::format) + +(format t "~:U" 3192624000) + prints `03/03/2001' + +(format t "~,vU" "%A" 3192624000) + prints `Saturday' + +(format t "~:N" 3192624000) + prints `3,192,624,000' + +(format t "~:M" 3192624000) + prints `ZAR 3,192,624,000.00` + +@end verbatim + @end deffn
+@anchor {Function parse-number} +@deffn {Function} parse-number num-string &optional (locale *locale*) +Parses the string @emph{num-string} into a number using @emph{locale}. +@end deffn
@section Classes @@ -304,7 +355,7 @@ Then you add resources to your bundle using either @code{add-resource} or @code{add-resources}.
-@lisp +@verbatim (add-resources (bundle "af_") "showtime" "Dankie, die tyd is ~:@/cl-l10n:format-time/~%")
@@ -312,7 +363,7 @@ (add-resources (bundle "") "showtime" "Thanks, the time is ~:@/cl-l10n:format-time/~%")
-@end lisp +@end verbatim
Then by using @code{gettext} you can lookup locale specific strings. @lisp @@ -354,7 +405,7 @@ @section API @anchor {Generic add-resource} @deffn {Generic} add-resource bundle from to locale-name -Adds an entry to @emph{bundle} for @emph{locale-name} mappings +Adds an entry to @emph{bundle} for @emph{locale-name} mapping @emph{from} to @emph{to}. The @emph{locale-name} does not have to be a full name like ``en_US'' but can be a partial match like ``en_''. Adding mappings for these two locale-names will