2016-05-25 04:27:03 +03:00
|
|
|
(ns status-im.i18n
|
|
|
|
(:require
|
|
|
|
[status-im.translations.en :as en]))
|
|
|
|
|
|
|
|
(set! js/window.I18n (js/require "react-native-i18n"))
|
|
|
|
(set! (.-fallbacks js/I18n) true)
|
2016-05-25 18:57:06 +03:00
|
|
|
(set! (.-defaultSeparator js/I18n) "/")
|
2016-05-25 04:27:03 +03:00
|
|
|
|
|
|
|
(set! (.-translations js.I18n) (clj->js {:en en/translations}))
|
|
|
|
|
2016-05-25 18:57:06 +03:00
|
|
|
(defn label [path & options]
|
2016-05-25 04:55:44 +03:00
|
|
|
(.t js/I18n (name path) (clj->js options)))
|
2016-05-25 04:27:03 +03:00
|
|
|
|
2016-06-02 13:43:26 +03:00
|
|
|
(defn label-pluralize [count path & options]
|
|
|
|
(.p js/I18n count (name path) (clj->js options)))
|
2016-06-01 14:35:22 +03:00
|
|
|
|
2016-05-25 04:27:03 +03:00
|
|
|
(comment
|
|
|
|
(defn deep-merge [& maps]
|
|
|
|
(if (every? map? maps)
|
|
|
|
(apply merge-with deep-merge maps)
|
|
|
|
(last maps)))
|
|
|
|
|
|
|
|
(defn add-translations [new-translations]
|
|
|
|
(let [translations (.-translations js/I18n)]
|
|
|
|
(set! (.-translations js/I18n) (clj->js (deep-merge (js->clj translations) new-translations)))))
|
|
|
|
)
|