From 4ceb4067715980e9c38c4a244a20c7538c8b59f4 Mon Sep 17 00:00:00 2001 From: MagusMachinae Date: Tue, 9 Aug 2022 13:17:33 +0100 Subject: [PATCH] Allow passing of locale map in opts to set localisation via formatLocale --- src/cljs/oz/core.cljs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cljs/oz/core.cljs b/src/cljs/oz/core.cljs index 6bed9f795..c812246d3 100644 --- a/src/cljs/oz/core.cljs +++ b/src/cljs/oz/core.cljs @@ -29,7 +29,7 @@ (defn ^:no-doc embed-vega ([elem doc] (embed-vega elem doc {})) - ([elem doc {:as opts :keys [view-callback]}] + ([elem doc {:as opts :keys [view-callback locale]}] (when doc (let [doc (clj->js doc) opts (-> opts @@ -40,6 +40,8 @@ opts (merge {:renderer :canvas} ;; Have to think about how we want the defaults here to behave opts)] + (when locale + (. vega formatLocale (clj->js locale))) (-> (vegaEmbed* elem doc (clj->js opts)) (.then (fn [res] (when view-callback