In one of the early original series episodes, Spock explains that the translator picks up "brain waves," does a frequency analysis of different patterns, and translates these into "universal" linguistic concepts. In that episode, he programs the translator to analyze energy from an incorporeal "cloud" being, and is able to communicate fluently with the creature within minutes!
In one New Generation episode, the translator is stumped by Darmok, a language which relies almost exclusively on cultural metaphors. Only this makes no sense, as the metaphors are "frozen" (they always use the same metaphor to express a given concept), so the universal translator should be able to treat the whole metaphor as any other word. Imagine, for instance, that we always said "not the brightest bulb in the chandelier" instead of "stupid." A Klingon learning English might not know what "chandeliers" and "bulbs" were, but would soon figure out that the whole expression simply meant "stupid." As far as I know, all languages contain "frozen" metaphors. Why should "up" mean "happy" and "down" mean "sad"? Why should "left" and "right" be used to describe political philosophies? Originally metaphorical, these terms caught on, and are now conventional. (See George Lakoff & Mark Johnson, 1980, Metaphors we live by, University of Chicago Press.)
One DS-9 episode had a new (humanoid) species emerge from the wormhole, and at first we heard their language directly, untranslated, because the universal translator had not yet isolated any consistent patterns to translate. A short while later, we began hearing articles and conjunctions in English, a content word here or there, surrounded by bursts of unintelligible alien communication. Within hours, of course, everyone was communicating fluently, even colloquially....
Like many aspects of Star Trek, the Universal Translator is an extremely improbable thing, but oh, what a lovely dream!
Well, it is just a TV show, after all, and the viewers are still in the 20th century, so it would be rather distracting to have the characters speaking in future-English as we struggled to comprehend. I'm more than happy to suspend my disbelief in this case. It's not good linguistics, but it's good TV.
Of all the alien life forms the Federation has encountered, Trek only devotes attention to the languages of other humanoids. (Speciecentrism? how politically incorrect!) Federation citizens learn to communicate with other life forms via the universal translator, but don't try to actually learn/use their systems of communication as they do with humanoid languages.
Officially, TREK has only one fully developed alien language, Klingon, a truly wonderful language created for the show by Marc Okrand. If you like morphology, you'll love this language. Okrand has even considered sociolinguistic aspects: dialect (how different Klingons would speak differently) and speech registers (how an individual Klingon would adapt his or her speech to the situation). It's also interesting from a Sapir-Whorf/linguistic relativity point of view: Are Klingons so warlike because they absorb such a harsh, martial language as children? Or is the language merely reflecting the culture? You'll want to read Okrand's The Klingon Dictionary, Pocket Books 1992 .
Unofficially, fandom has greatly enhanced our knowledge of the languages in the Star Trek Universe. If a few words of some alien speech are given on one of the Trek shows, some fan out in cyberspace will happily spend years expanding this into a language. Bless their hearts!