I was reading this article and I am not too sure about sentence I came across.
男の子は「... 珍しいカブトムシだとわかってとてもうれしいです」と話していました。
I have a few problem areas here. I read it as: The boy said 'If the beetle is rare then understand and very happy'
I believe だと is being used a a conditional here. So to me the part 珍しいカブトムシだと means: If/When the beetle is rare. But After that it falls a part as I'm not sure how わかってとてもうれしい should be handled