Most of the time, it's depicted as a machine that works with a communications monitor. An exception is the Babel fish from The Hitchhiker's Guide to the Galaxy, a small organism that fits in the user's ear. The universal translator is convenient when science is not the main priority, or when the author prefers to ignore linguistic issues.
Some writers seek greater plausibility by instead having computer translation that requires collecting a database of the new language, often by listening to radio transmissions.
See machine translation and speech recognition for a discussion of real-world natural language processing technologies.