Here's a patch to srfi/19 that makes the localization initialization lazy:

Does anyone object?

Jay

Index: time.ss
===================================================================
--- time.ss     (revision 14641)
+++ time.ss     (working copy)
@@ -95,23 +95,26 @@
           date->string string->date
           )

-  ;; SRFI-29: Localization initialization:
-  (re-read-locale)
-  (or (load-bundle! (list* 'srfi-19
-                         (current-language)
-                         (current-country)
-                         (current-locale-details)))
-      ;; A little bit less specific
-      (load-bundle! (list 'srfi-19
-                         (current-language)
-                         (current-country)))
-      ;; less specific
-      (load-bundle! (list 'srfi-19 (current-language)))
-      ;; the least specific one (this one *do* exists!, it comes with
this srfi) don't worry:
-      (load-bundle! (list 'srfi-19)))
-
+  (define localized? #f)
   (define localized-message
     (lambda (message-name)
+      (unless localized?
+        ;; SRFI-29: Localization initialization:
+        (re-read-locale)
+        (or (load-bundle! (list* 'srfi-19
+                                 (current-language)
+                                 (current-country)
+                                 (current-locale-details)))
+            ;; A little bit less specific
+            (load-bundle! (list 'srfi-19
+                                (current-language)
+                                (current-country)))
+            ;; less specific
+            (load-bundle! (list 'srfi-19 (current-language)))
+            ;; the least specific one (this one *do* exists!, it
comes with this srfi) don't worry:
+            (load-bundle! (list 'srfi-19)))
+        (set! localized? #t))
+
       (localized-template 'srfi-19 message-name)))

   ;; Constants


-- 
Jay McCarthy <j...@cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93
_________________________________________________
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev

Reply via email to