On Thu, Mar 06, 2008 at 09:46:49AM +0100, felix winkelmann wrote:
> 
> You need a version of "format" that is more capable than the
> builtin one (which builds on [sf]printf). Install "format-modular"
> or "format", and load that before srfi-29.

Did that; now I get:

Error: (vector-ref) out of range
#("12:00" "Fred")
2

        Call history:

        <syntax>                (localized-message (quote goodbye) myname)
        <syntax>                (quote goodbye)
        <syntax>                (display #\newline)
        <eval>          (display (localized-message (quote time) "12:00" 
myname))
        <eval>          (localized-message (quote time) "12:00" myname)
        <eval>          [localized-message] (apply format (cons 
(localized-template (quote hello-program) message-name) args))
        <eval>          [localized-message] (cons (localized-template (quote 
hello-program) message-name) args)
        <eval>          [localized-message] (localized-template (quote 
hello-program) message-name)     <--

Code attached.  Not that it matters, as srfi-29 isn't sufficient for
me (see
http://search.cpan.org/~petdance/Locale-Maketext-1.12/lib/Locale/Maketext/TPJ13.pod
) but now I'm curious.  :)

-Robin


-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
(require-extension format-modular)
(require-extension srfi-29)

(let ((translations
       '(((en) . ((time . "Its ~a, ~a.")
                (goodbye . "Goodbye, ~a.")))
         ((fr) . ((time . "[EMAIL PROTECTED], c'est ~a.")
                (goodbye . "Au revoir, ~a."))))))
  (for-each (lambda (translation)
              (let ((bundle-name (cons 'hello-program (car translation))))
                     (declare-bundle! bundle-name (cdr translation))))
             translations))

(define localized-message
  (lambda (message-name . args)
    (apply format (cons (localized-template 'hello-program
                                            message-name)
                        args))))

(current-language 'fr)
(let ((myname "Fred"))
  (display (localized-message 'time "12:00" myname))
  (display #\newline)

  (display (localized-message 'goodbye myname))
  (display #\newline))
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to