[FIX #4848] ui, i18n: Replace currency indicator with ~
Signed-off-by: Goran Jovic <goranjovic@gmail.com>
This commit is contained in:
parent
375515b04f
commit
06bb8c6348
|
@ -389,11 +389,12 @@
|
|||
(translation (subs locale 0 2))
|
||||
fallback)))
|
||||
|
||||
(defn format-currency [value currency-code]
|
||||
(defn format-currency
|
||||
([value currency-code]
|
||||
(format-currency value currency-code true))
|
||||
([value currency-code currency-symbol?]
|
||||
(.addTier2Support goog.i18n.currency)
|
||||
|
||||
(def currency-code-to-nfs-map
|
||||
{"ZAR" (.-NumberFormatSymbols_af goog.i18n)
|
||||
(let [currency-code-to-nfs-map {"ZAR" (.-NumberFormatSymbols_af goog.i18n)
|
||||
"ETB" (.-NumberFormatSymbols_am goog.i18n)
|
||||
"EGP" (.-NumberFormatSymbols_ar goog.i18n)
|
||||
"DZD" (.-NumberFormatSymbols_ar_DZ goog.i18n)
|
||||
|
@ -453,10 +454,18 @@
|
|||
"VND" (.-NumberFormatSymbols_vi goog.i18n)
|
||||
"CNY" (.-NumberFormatSymbols_zh goog.i18n)
|
||||
"HKD" (.-NumberFormatSymbols_zh_HK goog.i18n)
|
||||
"TWD" (.-NumberFormatSymbols_zh_TW goog.i18n)})
|
||||
|
||||
(def custom-nfs (currency-code-to-nfs-map currency-code))
|
||||
(set! (.-NumberFormatSymbols goog.i18n) (if custom-nfs custom-nfs (.-NumberFormatSymbols_en goog.i18n)))
|
||||
"TWD" (.-NumberFormatSymbols_zh_TW goog.i18n)}
|
||||
nfs (or (get currency-code-to-nfs-map currency-code)
|
||||
(.-NumberFormatSymbols_en goog.i18n))]
|
||||
(set! (.-NumberFormatSymbols goog.i18n)
|
||||
(if currency-symbol?
|
||||
nfs
|
||||
(-> nfs
|
||||
(js->clj :keywordize-keys true)
|
||||
;; Remove any currency symbol placeholders in the pattern
|
||||
(update-in [:CURRENCY_PATTERN] #(string/replace % #"\s*¤\s*" ""))
|
||||
clj->js)))
|
||||
(.format
|
||||
(new goog.i18n.NumberFormat (.-CURRENCY goog.i18n.NumberFormat.Format) currency-code)
|
||||
value))
|
||||
value))))
|
||||
|
||||
|
|
|
@ -68,7 +68,8 @@
|
|||
(-> balance-total-value
|
||||
(money/with-precision 2)
|
||||
str
|
||||
(i18n/format-currency (:code currency))))
|
||||
(i18n/format-currency (:code currency) false)
|
||||
(->> (str "~"))))
|
||||
"...")))
|
||||
|
||||
(re-frame/reg-sub :prices-loading?
|
||||
|
|
Loading…
Reference in New Issue