In Star Trek we have been made familiar with a fictional device called the Universal translator, which allows for instant translation between different species without those species needing to learn Federation Standard. This was first mentioned and used in Star Trek: Enterprise where an Ensign called Hoshi Sato improved on the translation tech currently available and the improvements allowed for a portable unit to be used, thus making communication easier. Initially, the new language was compared to other Terran dialects and friendly species to make strange words sound like Federation Standard to the humans in Star Trek; the same was done for all the different languages among the people.
In Captain Archer’s time, the universal translators were blocky and small enough to be hidden when on missions. Eventually, the universal translators were merged with the personal communications devices, so when away teams during Archer’s time visited a planet the communicators automatically translated. This only worked if the foreign language was already known, otherwise, away teams during the 2150s used a proper universal translator to collect data on the new language. This continued until the creation of the United Federation of Planets.
Before 2161, the collection of languages was at best rudimentary, but collecting scientific data was more refined and Starfleet had more foreign languages to compare new ones too. Over the decades, the universal translators improved and ended up as a feature of comm badges we see in later Star Trek series. In today’s world a form of these devices exist, but they operate in a limited way: You speak a phrase in English, and it will spit back what that phrase would be in another language. One drawback is that they only work with predetermined words we know about, but the underlying technology does exist in today’s world.
Want to know more about the technology available in the Star Trek universe? Check out UFOP: Starbase 118 Star Trek PBEM RPG’s very own Starfleet Equipment & Devices page.