fix translation pluralization

This commit is contained in:
Adrian Tiberius 2016-06-01 14:35:22 +03:00
parent 755e9bf2b3
commit 13c506491f
3 changed files with 13 additions and 9 deletions

View File

@ -3,12 +3,12 @@
(:require [re-frame.core :refer [subscribe dispatch]] (:require [re-frame.core :refer [subscribe dispatch]]
[clojure.string :as s] [clojure.string :as s]
[status-im.components.react :refer [view [status-im.components.react :refer [view
text text
image image
icon icon
touchable-highlight touchable-highlight
list-view list-view
list-item]] list-item]]
[status-im.components.chat-icon.screen :refer [chat-icon-view-action [status-im.components.chat-icon.screen :refer [chat-icon-view-action
chat-icon-view-menu-item]] chat-icon-view-menu-item]]
[status-im.chat.styles.screen :as st] [status-im.chat.styles.screen :as st]
@ -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]])) [status-im.i18n :refer [label label-pluralize]]))
(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 :t/members {:count cnt}))]] (label-pluralize cnt :t/members))]]
;; 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

@ -11,6 +11,9 @@
(defn label [path & options] (defn label [path & options]
(.t js/I18n (name path) (clj->js options))) (.t js/I18n (name path) (clj->js options)))
(defn label-pluralize [count path]
(.p js/I18n count (name path)))
(comment (comment
(defn deep-merge [& maps] (defn deep-merge [& maps]
(if (every? map? maps) (if (every? map? maps)

View File

@ -18,7 +18,8 @@
:and-you "and you" :and-you "and you"
:search-chat "Search chat" :search-chat "Search chat"
:members {:one "1 member, 1 active" :members {:one "1 member, 1 active"
:other "{{count}} members, {{count}} active"} :other "{{count}} members, {{count}} active"
:zero "no members"}
:last-active "Active a minute ago" :last-active "Active a minute ago"
;profile ;profile