Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

`with-locale` was supposed to be marked as DEPRECATED

  • Loading branch information...
commit 8e9dc6e5a4b89ffbbdf3d26e2384bc4e30e66eac 1 parent f4d01bc
@ptaoussanis authored
@@ -30,8 +30,7 @@ Add the necessary dependency to your [Leiningen][] `project.clj` and `require` t
[com.taoensso/tower "2.1.0"] ; project.clj
-(ns my-app (:require [taoensso.tower :as tower
- :refer (with-locale with-tscope *locale*)])) ; ns
+(ns my-app (:require [taoensso.tower :as tower :refer (with-tscope)])) ; ns
### Translation
@@ -161,8 +160,6 @@ Check out `countries`, `languages`, and `timezones`.
Quickly internationalize your Ring web apps by adding `taoensso.tower.ring/wrap-tower` to your middleware stack.
-It'll select the best available locale for each request then establish a thread-local locale binding with `tower/*locale*`, and add `:locale` and `:t` request keys.
See the docstring for details.
## This project supports the CDS and ![ClojureWerkz]( goals
11 src/taoensso/tower.clj
@@ -45,13 +45,6 @@
(mapv try-locale [nil :invalid :jvm-default :en-US :en-US-var1 (Locale/getDefault)])
(time (dotimes [_ 10000] (locale :en))))
-(def ^:dynamic *locale* nil)
-(defmacro with-locale
- "Executes body within the context of thread-local locale binding, enabling
- use of translation and localization functions. `loc` should be of form :en,
- :en-US, :en-US-variant, or :jvm-default."
- [loc & body] `(binding [*locale* (locale ~loc)] ~@body))
;;;; Localization
(def ^:private ^:const dt-styles
@@ -481,6 +474,10 @@
;; to act as a quasi drop-in replacement for v1, despite the huge changes
;; under-the-covers.
+(def ^:dynamic *locale* nil)
+(defmacro with-locale "DEPRECATED."
+ [loc & body] `(binding [*locale* (locale ~loc)] ~@body))
(def ^:private migrate-tconfig
(fn [tconfig scope]
4 src/taoensso/tower/cljs_macros.clj
@@ -6,10 +6,6 @@
"Tower's standard dictionary compiler, as a compile-time macro."
[dict] (tower/dict-compile dict))
-(defmacro with-locale [loc & body]
- `(binding [taoensso.tower/*locale* (taoensso.tower/locale ~loc)]
- ~@body))
(defmacro with-tscope [translation-scope & body]
`(binding [taoensso.tower/*tscope* ~translation-scope]
2  test/taoensso/tower/tests/main.clj
@@ -1,6 +1,6 @@
(ns taoensso.tower.tests.main
(:require [expectations :as test :refer :all]
- [taoensso.tower :as tower :refer (with-locale with-tscope)])
+ [taoensso.tower :as tower :refer (with-tscope)])
(:import [java.util Date]))
(comment (test/run-tests '[taoensso.tower.tests.main]))
Please sign in to comment.
Something went wrong with that request. Please try again.