mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-13 02:04:28 +00:00
bd3f9570b3
move translations to JSON read translations from JSON remove old clojurescript translations files reload clojurescript on changes in translations folder
22 lines
497 B
Clojure
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))
|