Roman Volosovskyi bd3f9570b3
[#5649] Change react-native-i18n language files to js (Lokalise)
move translations to JSON
read translations from JSON
remove old clojurescript translations files
reload clojurescript on changes in translations folder
2018-09-10 16:14:12 +03:00

22 lines
497 B
Clojure

(ns status-im.i18n
(:require [clojure.string :as string]))
(defn read-file [f]
(when (.isFile f)
(let [locale (-> f
.getName
(string/split #"\.")
first)
content (slurp f)]
[(keyword locale) content])))
(defn read-translations []
(->>
(java.io.File. "translations")
file-seq
(keep read-file)
vec))
(defmacro translations [languages]
(select-keys (into {} (read-translations)) languages))