Add support for default i18n for items
This commit is contained in:
@@ -9,8 +9,11 @@
|
|||||||
(str "### " (get i18n category)))
|
(str "### " (get i18n category)))
|
||||||
|
|
||||||
(defn produce-item [item nights i18n]
|
(defn produce-item [item nights i18n]
|
||||||
(let [qnt (int (Math/ceil ((:quantity item) nights)))]
|
(let [quantity (if (= (type (:quantity item)) java.lang.Long) (:quantity item) ((:quantity item) nights))
|
||||||
(str "- [ ] " (get i18n (:key item)) (if (> qnt 1) (str " x" qnt) ""))))
|
quantity-long (long (Math/ceil quantity))
|
||||||
|
quantity-string (if (> quantity-long 1) (str " x" quantity-long) "")
|
||||||
|
name (or (get i18n (:key item)) (:name item))]
|
||||||
|
(str "- [ ] " name quantity-string)))
|
||||||
|
|
||||||
(defn produce-items [items nights i18n]
|
(defn produce-items [items nights i18n]
|
||||||
(->> items
|
(->> items
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
(ns packer.model (:gen-class))
|
(ns packer.model (:gen-class))
|
||||||
|
|
||||||
(defrecord Item [key quantity])
|
(defrecord Item [key name quantity])
|
||||||
|
|
||||||
(defrecord Template [store i18n profile])
|
(defrecord Template [store i18n profile])
|
||||||
Reference in New Issue
Block a user