Skip to content
Browse files

Merge branch 'dev'

  • Loading branch information...
2 parents 5fb0c05 + efccebf commit fc8f2dd883e3d739a26864af8141a94cc2942bef @ptaoussanis committed Oct 26, 2012
Showing with 17 additions and 14 deletions.
  1. +2 −2 README.md
  2. +1 −1 project.clj
  3. +12 −10 src/taoensso/tower.clj
  4. +2 −1 test/test_tower/main.clj
View
4 README.md
@@ -1,7 +1,7 @@
Current [semantic](http://semver.org/) version:
```clojure
-[com.taoensso/tower "0.12.2"]
+[com.taoensso/tower "0.12.3"]
```
**Breaking changes** since _0.10.x_:
@@ -38,7 +38,7 @@ lein all test
Depend on Tower in your `project.clj`:
```clojure
-[com.taoensso/tower "0.12.2"]
+[com.taoensso/tower "0.12.3"]
```
and `require` the library:
View
2 project.clj
@@ -1,4 +1,4 @@
-(defproject com.taoensso/tower "0.12.2"
+(defproject com.taoensso/tower "0.12.3"
:description "Simple internationalization and localization library for Clojure."
:url "https://github.com/ptaoussanis/tower"
:license {:name "Eclipse Public License"}
View
22 src/taoensso/tower.clj
@@ -46,7 +46,7 @@
(fn [{:keys [dev-mode? locale k-or-ks]}]
(if dev-mode?
(timbre/warn "Missing translation" k-or-ks "for" locale)
- (timbre/error "Missing translation" k-or-ks "for" locale)))}))
+ (timbre/debug "Missing translation" k-or-ks "for" locale)))}))
(defn set-config! [[k & ks] val] (swap! config assoc-in (cons k ks) val))
@@ -442,17 +442,19 @@
(if-not (keyword? last-kchoice*)
last-kchoice* ; Return provided explicit fallback value
- (do (log-missing-translation!-fn
- {:dev-mode? dev-mode? :locale *Locale* :k-or-ks k-or-ks})
+ (do
+ (log-missing-translation!-fn
+ {:dev-mode? dev-mode? :locale *Locale* :k-or-ks k-or-ks})
- ;; Try fall back to named keys in (different) default locale
- (when-not (= @lchoices* lchoices)
- (some get-in-dict (for [k kchoices] [default-locale (sk k)])))
+ (or
+ ;; Try fall back to named keys in (different) default locale
+ (when-not (= @lchoices* lchoices)
+ (some get-in-dict (for [k kchoices] [default-locale (sk k)])))
- ;; Try fall back to :missing key in named or default locale
- (when-let [pattern (some get-in-dict (for [l @lchoices*]
- [l :missing]))]
- (format-msg pattern k-or-ks))))))))))
+ ;; Try fall back to :missing key in named or default locale
+ (when-let [pattern (some get-in-dict (for [l @lchoices*]
+ [l :missing]))]
+ (format-msg pattern k-or-ks)))))))))))
(comment (with-locale :en-ZA (t :example/foo))
(with-locale :en-ZA (with-scope :example (t :foo)))
View
3 test/test_tower/main.clj
@@ -128,7 +128,8 @@
:en ":en :example/foo text"
:en-US ":en-US :example/foo text"
:en-GB ":en :example/foo text"
- :default ":en :example/foo text")
+ :default ":en :example/foo text"
+ :zh-CN ":en :example/foo text")
;; Scoping
(with-locale :en

0 comments on commit fc8f2dd

Please sign in to comment.
Something went wrong with that request. Please try again.