taka2ru avatar taka2ru committed 4388ace Draft

adopt clojure 1.4

Comments (0)

Files changed (3)

 syntax: regexp
 ^pom.xml
 \.jar$
+^target/
 ^lib/
 ^classes/
 ^native/
-(defproject jp.taka2ru/i18n "0.0.1"
+(defproject jp.taka2ru/i18n "0.0.2"
   :description "Internationalization (i18n) library using ResourceBundle."
   :url "https://bitbucket.org/taka2ru/clj-i18n"
-  :dependencies [[org.clojure/clojure "1.2.1"]
-                 [org.clojure/clojure-contrib "1.2.0"]])
+  :dependencies [[org.clojure/clojure "1.4.0"]
+                 [org.clojure/core.incubator "0.1.2"]])
 

src/i18n/core.clj

 (ns i18n.core
   (:import [java.util ResourceBundle$Control])
-  (:use clojure.contrib.core
-        clojure.contrib.def))
+  (:use [clojure.core.incubator]))
 
 (def ^{:dynamic true :tag String} *default-charset* "UTF-8")
 
                     (into-array String [(to-str k) (to-str v)]))
                (into-array (Class/forName "[Ljava.lang.Object;")))))))
 
-(defn-memo ^java.util.ResourceBundle resource-bundle [resource-name locale]
+(defn ^java.util.ResourceBundle resource-bundle [resource-name locale]
   (java.util.ResourceBundle/getBundle
     (to-str resource-name) (to-locale locale) (clojure.lang.RT/baseLoader)
     (resource-bundle-control)))
 
-(defn-memo resource-keys [resource-name locale]
+(defn resource-keys [resource-name locale]
   (map keyword (enumeration-seq
                  (.getKeys (resource-bundle resource-name locale)))))
 
-(defn-memo resource [resource-name locale resource-key]
+(defn resource [resource-name locale resource-key]
   (.getObject (resource-bundle resource-name locale) (to-str resource-key)))
 
-(defn clear-cache []
-  (let [cacheList (.getDeclaredField java.util.ResourceBundle "cacheList")]
-    (.setAccessible cacheList true)
-    (.clear (.get cacheList java.util.ResourceBundle))))
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.