taoensso / tower

i18n & L10n library for Clojure/Script
https://www.taoensso.com/tower
Eclipse Public License 1.0
277 stars 24 forks source link

AssertionError from make-t when map with :missing is loaded from external resource #60

Closed juhani-hietikko closed 9 years ago

juhani-hietikko commented 9 years ago

Hi again, Peter! 3.1.0-beta1 fixed the other issue I reported, but unfortunately there appears to be regression from 3.0.2 when locale maps are loaded from external resources. Specifically, if a :missing key happens to be present in the external resource map, an AssertionError is thrown from make-t:

java.lang.AssertionError: Condition failed in taoensso.tower:516 [pred-form, val]: [(map? (load1 dict)), #[ExceptionInfo clojure.lang.ExceptionInfo: Failed to load dictionary from resource: |Missing translation: [%1$s %2$s %3$s]| {:dict "|Missing translation: [%1$s %2$s %3$s]|"}]] at taoensso.encore$assertion_error.invoke(encore.clj:314) at taoensso.encore$hthrow.doInvoke(encore.clj:327) at clojure.lang.RestFn.invoke(RestFn.java:533) at taoensso.tower$fn15838$fn15853.invoke(tower.clj:516) at taoensso.tower$fn15838$fn15853$iter1586015864$fn15865.invoke(tower.clj:526) at clojure.lang.LazySeq.sval(LazySeq.java:40) at clojure.lang.LazySeq.seq(LazySeq.java:49) at clojure.lang.Cons.next(Cons.java:39) at clojure.lang.RT.next(RT.java:598) at clojure.core$next.invoke(core.clj:64) at clojure.core.protocols$fn6086.invoke(protocols.clj:146) at clojure.core.protocols$fn6057$G60526066.invoke(protocols.clj:19) at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31) at clojure.core.protocols$fn6078.invoke(protocols.clj:54) at clojure.core.protocols$fn6031$G60266044.invoke(protocols.clj:13) at clojure.core$reduce.invoke(core.clj:6289) at clojure.core$into.invoke(core.clj:6341) at taoensso.tower$fn15838$fn15853.invoke(tower.clj:523) at taoensso.tower$fn15838$fn15853$iter1586015864$fn__15865.invoke(tower.clj:526) at clojure.lang.LazySeq.sval(LazySeq.java:40) at clojure.lang.LazySeq.seq(LazySeq.java:49) at clojure.lang.RT.seq(RT.java:484) at clojure.core$seq.invoke(core.clj:133) at clojure.core.protocols$seq_reduce.invoke(protocols.clj:30) at clojure.core.protocols$fn6078.invoke(protocols.clj:54) at clojure.core.protocols$fn6031$G60266044.invoke(protocols.clj:13) at clojure.core$reduce.invoke(core.clj:6289) at clojure.core$into.invoke(core.clj:6341) at taoensso.tower$fn15838$fn15853.invoke(tower.clj:523) at taoensso.tower$fn15937$fn15945.doInvoke(tower.clj:632) at clojure.lang.RestFn.invoke(RestFn.java:423) at taoensso.tower$make_t_uncached$compile116006.invoke(tower.clj:695) at clojure.lang.AFn.applyToHelper(AFn.java:152) at clojure.lang.AFn.applyTo(AFn.java:144) at clojure.core$apply.invoke(core.clj:624) at taoensso.encore$memoizeSTAR$fn14359$fn14368$fn14370.invoke(encore.clj:1373) at clojure.lang.Delay.deref(Delay.java:37) at clojure.core$deref.invoke(core.clj:2200) at taoensso.encore$memoizeSTAR$fn14359.doInvoke(encore.clj:1363) at clojure.lang.RestFn.invoke(RestFn.java:397) at taoensso.tower$make_t_uncached$fn__16010.invoke(tower.clj:699) at taoensso.tower$make_t_uncached$new_t__16012.doInvoke(tower.clj:702)

ptaoussanis commented 9 years ago

Hi Juhani, thanks for the report. I can reproduce this side. Will investigate.

ptaoussanis commented 9 years ago

Just pushed [com.taoensso/tower "3.1.0-beta2"] to Clojars which should fix this. Release info: https://github.com/ptaoussanis/tower/releases

Let me know if you run into any other issues?

Cheers :-)

juhani-hietikko commented 9 years ago

Thanks for the quick response yesterday! 3.1.0-beta2 is working fine so far.