On 30 nov, 02:42, Randall R Schulz <[EMAIL PROTECTED]> wrote:
> On Saturday 29 November 2008 11:01, ppierre wrote:
>
> > 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]*)"
>
> Hmm...
>
> Guy with right eyebrow raised, non-plussed,
> yet drooling, as he digests the Latin alphabet?

public Locale(String language,
              String country,
              String variant)
ISO-639 and ISO-3166

You right I really dislike regular expression : short but inepressive
and error prone. I  didn't write this in a rigorous way. I trow it to
ask : Is there a preferred way to write locale setting :
"fr_CH"
["fr" "CH"]
:fr :CH
...
or just : (java.util.Locale. "fr" "CH")

In fact the only important code is :

final static public Var LOCALE =
  Var.intern(CLOJURE_NS, Symbol.create("*locale*"), null);

(defn format
  "Formats a string using java.lang.String.format, see
java.util.Formatter for format
  string syntax"
  [fmt & args]
  (let [locale (or *locale*
                   (java.util.Locale/getDefault))]
    (String/format locale fmt (to-array args))))

Just two lines :
A dynamic var in Clojure for setting locale.
And using it systematically when writing i33n and l11n codes.

Then you would use third-party library with-out regretting your non-
latin non-english status.

:)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to