About 99% of the incidents where our heroes run into a new language happen like this: their starship encounters a starship from another species, and both sides want to talk (even if only to threaten the other side with immediate destruction).
It sounds rather natural, then, that both sides would understand each other immediately. After all, it's not the two captains speaking - it's the two starship computers first establishing contact and running their hyperadvanced "let's be friends and learn each other's language" programs, then allowing the captains to have a word. Essentially, at first contact with an alien species, our heroes hand over a whole library of dictionaries, grammar guides and whatnot, and receive the same in return. The computers may take an eternity to initially sort out how to transfer the data, but that eternity is only nanoseconds long.
It's extremely seldom that our heroes encounter an all-new species when deprived of their starship. And if such an encounter starts out with the two sides speaking the same language (say, our DS9 heroes and the Vorta/Jem'Hadar in "Jem'Hadar"), we can usually assume that the opponent has gone to the trouble of learning English before initiating this contact.
Handheld devices or chest communicators can probably do some translating, but they might be limited to processing already known languages. That is, unless they are in contact with more powerful computers such as nearby starships. And when even the commbadges are taken away from our heroes (as in "Basics"), their implanted UTs probably take over, so that they can continue conversing in known languages (such as Kazon and Talaxian) but will be unable to decipher new languages (such as that of the locals on the planet where the Kazon stranded our heroes).
That pretty much covers all the bases already. Save, perhaps, for those cases where translations are incomplete. But those could be one of two things:
a) The word left untranslated is an insult, and the UT is a family-rated device - so Picard can say "merde" and a Romulan can say "veruul" and only a fellow French speaker or Romulan expert can understand the word (or perhaps their UTs in turn go to the trouble of translating those words to a language they are unable to understand?).
b) The word in the middle of an alienese phrase is actually (and quite surprisingly) spoken in English, which the UT indicates by mirroring, by translating the rest of the phrase but not the word. This would loop back to a) because an alien wanting to insult an English speaker might want to use an insult the opponent is sure to understand.
Timo Saloniemi