fix label function

This commit is contained in:
Roman Volosovskyi 2016-06-02 15:48:57 +03:00
parent 6eeefb2efb
commit 11edd55b5a
2 changed files with 7 additions and 8 deletions

View File

@ -18,7 +18,7 @@
[status-im.components.toolbar :refer [toolbar]] [status-im.components.toolbar :refer [toolbar]]
[status-im.chat.views.message :refer [chat-message]] [status-im.chat.views.message :refer [chat-message]]
[status-im.chat.views.new-message :refer [chat-message-new]] [status-im.chat.views.new-message :refer [chat-message-new]]
[status-im.i18n :refer [label label-pluralize]])) хыефегы-шьюш18т Жкуаук хдфиудъъ))
(defn contacts-by-identity [contacts] (defn contacts-by-identity [contacts]
@ -186,7 +186,7 @@
[icon :group st/group-icon] [icon :group st/group-icon]
[text {:style st/members} [text {:style st/members}
(let [cnt (inc (count @contacts))] (let [cnt (inc (count @contacts))]
(label-pluralize cnt :t/members))]] (label :t/members {:count cnt}))]]
;; TODO stub data: last activity ;; TODO stub data: last activity
[text {:style st/last-activity} (label :t/last-active)])]))) [text {:style st/last-activity} (label :t/last-active)])])))

View File

@ -8,11 +8,10 @@
(set! (.-translations js.I18n) (clj->js {:en en/translations})) (set! (.-translations js.I18n) (clj->js {:en en/translations}))
(defn label [path & options] (defn label
(.t js/I18n (name path) (clj->js options))) ([path] (label path {}))
([path options]
(defn label-pluralize [count path & options] (.t js/I18n (name path) (clj->js options))))
(.p js/I18n count (name path) (clj->js options)))
(comment (comment
(defn deep-merge [& maps] (defn deep-merge [& maps]
@ -23,4 +22,4 @@
(defn add-translations [new-translations] (defn add-translations [new-translations]
(let [translations (.-translations js/I18n)] (let [translations (.-translations js/I18n)]
(set! (.-translations js/I18n) (clj->js (deep-merge (js->clj translations) new-translations))))) (set! (.-translations js/I18n) (clj->js (deep-merge (js->clj translations) new-translations)))))
) )