Detect Thoughts allows you to "know the surface thoughts" of another creature. If both creatures do not share a language, will the caster be able to understand the surface thoughts of the target?
Sharing a language with the target creature(s) isn't a stated requirement in the spell's description so you can understand the surface thoughts of that creature regardless of what languages either of you speak.
The only language requirements of the spell is that the target must speak a language because:
If the creature you choose [...] doesn't speak any language, the creature is unaffected.
It's also worth mentioning that detecting a creature's thoughts doesn't necessarily mean those thoughts are received as words. They could be received as pictures, smells, or whichever way the DM decides to communicate these thoughts with you.
Note that spells that require you to share a language specifically say so in their description. See, for instance, Modify Memory.