2016-05-25 04:27:03 +03:00
|
|
|
(ns status-im.i18n
|
|
|
|
(:require
|
2016-05-29 21:14:34 +03:00
|
|
|
[status-im.translations.en :as en]
|
|
|
|
[status-im.utils.utils :as u]))
|
2016-05-25 04:27:03 +03:00
|
|
|
|
2016-10-24 23:46:06 +03:00
|
|
|
(def i18n (js/require "react-native-i18n"))
|
2016-05-27 19:44:06 +03:00
|
|
|
(set! (.-fallbacks i18n) true)
|
|
|
|
(set! (.-defaultSeparator i18n) "/")
|
2016-05-25 04:27:03 +03:00
|
|
|
|
2016-05-27 19:44:06 +03:00
|
|
|
(set! (.-translations i18n) (clj->js {:en en/translations}))
|
2016-05-25 04:27:03 +03:00
|
|
|
|
2016-06-02 15:48:57 +03:00
|
|
|
(defn label
|
|
|
|
([path] (label path {}))
|
|
|
|
([path options]
|
2016-06-10 03:21:48 +03:00
|
|
|
(if (exists? i18n.t)
|
|
|
|
(.t i18n (name path) (clj->js options))
|
|
|
|
(name path))))
|
2016-06-01 14:35:22 +03:00
|
|
|
|
2016-06-01 14:44:04 +03:00
|
|
|
(defn label-pluralize [count path & options]
|
2016-06-01 19:11:51 +03:00
|
|
|
(if (exists? i18n.t)
|
|
|
|
(.p i18n count (name path) (clj->js options))
|
2016-08-24 10:29:40 +03:00
|
|
|
(name path)))
|
|
|
|
|
|
|
|
(defn message-status-label [status]
|
|
|
|
(->> status
|
|
|
|
(name)
|
|
|
|
(str "t/status-")
|
|
|
|
(keyword)
|
2016-10-24 23:46:06 +03:00
|
|
|
(label)))
|