Merge branch 'develop'

This commit is contained in:
Simon Brooke 2017-09-08 16:36:42 +01:00
commit 58dd06f390
3 changed files with 12 additions and 10 deletions

View file

@ -1,4 +1,4 @@
(defproject org.clojars.simon_brooke/internationalisation "1.0.2" (defproject org.clojars.simon_brooke/internationalisation "1.0.3"
:description "Internationalisation library for Clojure" :description "Internationalisation library for Clojure"
:url "https://github.com/simon-brooke/internationalisation" :url "https://github.com/simon-brooke/internationalisation"
:license {:name "Eclipse Public License" :license {:name "Eclipse Public License"
@ -9,4 +9,5 @@
:plugins [[lein-codox "0.10.3"]] :plugins [[lein-codox "0.10.3"]]
:profiles {:dev {:resource-paths ["resources"]}} :profiles {:dev {:resource-paths ["resources"]}}
:lein-release {:deploy-via :clojars} :lein-release {:deploy-via :clojars}
:signing {:gpg-key "Simon Brooke (Stultus in monte) <simon@journeyman.cc>"}
) )

View file

@ -160,12 +160,13 @@
(acceptable-languages accept-language-header))))] (acceptable-languages accept-language-header))))]
(timbre/debug (str "Found i18n file at '" file-path "'")) (timbre/debug (str "Found i18n file at '" file-path "'"))
(try (try
(slurp-resource (read-string
(or (slurp-resource
file-path (or
(join java.io.File/separator file-path
[resource-path (join java.io.File/separator
(str default-locale ".edn")]))) [resource-path
(str default-locale ".edn")]))))
(catch Exception any (catch Exception any
(timbre/error (str "Failed to load internationalisation because " (.getMessage any))) (timbre/error (str "Failed to load internationalisation because " (.getMessage any)))
nil)))) nil))))

View file

@ -199,11 +199,11 @@
(is (is
(= (=
"This is not a pipe" "This is not a pipe"
(:pipe (get-messages "en-GB, fr-FR;q=0.9" "resources/i18n" "en-GB")))) (:pipe (get-messages "en-GB, fr-FR;q=0.9" "i18n" "en-GB"))))
(is (is
(= (=
"Ceci n'est pas une pipe." "Ceci n'est pas une pipe."
(:pipe (get-messages "en-GB;q=0.9, fr-FR" "resources/i18n" "en-GB")))) (:pipe (get-messages "en-GB;q=0.9, fr-FR" "i18n" "en-GB"))))
(is (is
(= nil (get-messages "xx-XX;q=0.5, yy-YY" "resources/i18n" "zz-ZZ")) (= nil (get-messages "xx-XX;q=0.5, yy-YY" "i18n" "zz-ZZ"))
"If no usable file is found, an exception should not be thrown."))) "If no usable file is found, an exception should not be thrown.")))