Cohomology via the internal language of a topos