On 29 nov, 17:13, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Nov 29, 2008, at 10:48 AM, ppierre wrote: > > > But I can't compile core.clj when I put get-locale and with-locale > > inside it. > > What error do you get?
I have found it : #"(?:^|_)([a-zA-Z]*)" (re-pattern "(?:^|_)([a-zA-Z]*)") But I don't know why ? Never-mind, core is forbidden :) An other I don't understand : (apply java.util.Locale. ["fr" "FR"]) > >> - *locale* (should be set!-able as well), > > A set-locale function ? > > No, I meant that if *locale* becomes part of Clojure at some point, it > should be added to the list of bindings that are customarily pushed > around a repl or script so they always have thread-local bindings that > can be set with set! . See clojure.main/with-bindings for other > examples. OK, I was searching a special binding who cloud be hijacked. > What do you have in mind for the several cases in get-locale with one > argument? Well at first I wrote get-locale function for with-local macro : (with-locale ["fr" "FR" "WIN"] (...) (...)) I didn't think of : (with-locale "fr" "FR" (...)) So get-locale can take a list of string. And you can use it like java.util.Locale (get-locale "fr" "FR" "WIN") You can get locale from a parameter (with-locale java.util.Locale/ENGLISH ... ) or an environment variable (string) (with-locale "en_US.UTF-8") In fact I have in mind "fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3" (But I didn't wrote last one) get-locale function is an convenient catch-all for locale setting (same as duck-streams). I don't think that get-locale is necessarily a good idea : (with-locale (java.util.Locale. "fr" "FR" "WIN") (...) (...)) isn't that bad. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---