Fork me on GitHub
#reagent
<
2016-08-02
>
reefersleep08:08:07

@gadfly361 @hjrnunes: Having similarly structured EDN maps with different language entries and subscribing to the keys in the app-state, and, in one place setting the language by loading a that specific language's map into app-state, is also how I envisioned simple, homebrewed i18n in Clojure. I'm looking forward to actually implementing it in a Reagent app and watching the app react to me switching the language back and forth 🙂 For larger apps with a lot of entries, I guess you could do like I'm used to in Java and make 'sub-keys' for each subsection of the app, e.g. frontpage.title, profile.title etc

wasser16:08:32

@tonsky just released an i18n approach too: https://github.com/tonsky/tongue

seantempesta16:08:51

How do you attach/read/change metadata on an ratom? I see this in the source:

(defn atom
  "Like clojure.core/atom, except that it keeps track of derefs."
  ([x] (RAtom. x nil nil nil))
  ([x & {:keys [meta validator]}] (RAtom. x meta validator nil)))
which makes me think that you can pass a map with a meta key. But when I try and retrieve the metadata I get nil. (meta (reagent.core/atom nil {:meta {:loading true}})) ;; returns nil

pesterhazy17:08:40

@seantempesta: that would be (atom nil :meta {:loading true})

pesterhazy17:08:56

note the ampersand in the arg vector

mattsfrey22:08:15

Hey, wondering if there is anyway offhand to get the hiccup for a reagent component?

gadfly36122:08:55

You could call it with ( ) instead of [ ]

mattsfrey23:08:01

I tried that but when i print the result it is a bunch of JS nonsense

mattsfrey23:08:50

although it does appear to have the hiccup at the very end

gadfly36123:08:33

Hmm you could wrap the result of the function call with str or maybe use console.log with cljs-devtools (untested, but think it would work)

mattsfrey23:08:47

the js is coming from the event functions, onclick etc

mattsfrey23:08:16

I just want the hiccup in map form for testing the component basically

mattsfrey23:08:29

make sure given X props it returns certain patterns of hiccup

gadfly36123:08:00

Unfortunately not near a comp, hopefully others will chime in :)

mattsfrey23:08:11

well thanks for the suggestions nonetheless