Star Trek went the extra mile in creating some of its alien languages like Klingon and Vulcan, giving them real form and grammar rather than simply creating gibberish. However, while the final product of these languages feels methodically crafted, it turns out the beginning of the process was far less planned and much more hilarious. Marc Okrand, the linguist who created both Klingon and Vulcan says he was first offered the job to create the Vulcan language in Star Trek II: The Wrath of Kahn, and he actually was asked to create gibberish. Specifically, gibberish that would match the lip movements of the same words, that had already been spoken on the set in English. According to Okrand...
My real job, the one that really paid the bills, was closed captioning. The first program we did live was the Oscars, 1982. They flew me out to L.A., and I was having lunch with a friend who worked at Paramount. She and I go out to lunch, and the fact that I was a linguist came up --- I have a PhD in linguistics. She said: 'That's really interesting. We've been talking to linguists. There's this scene in the movie where Mr. Spock and this female Vulcan character have a conversation. When they filmed it, the actors were speaking English. But in post- production, everyone thinks it would be better if they were speaking Vulcan.' They wanted a linguist to come and make up gobbledygook that matches the lip movements. And I said, 'I can do that!'
It's actually pretty funny that the beginning of the process that led to the creation of alien languages so well designed that you can actually study and learn them yourself began within the constraints of only being able to create sounds that matched preexisting lip movements.
Apparently, Paramount liked Marc Okrand's work inventing these few words of Vulcan so much in Star Trek II that he tells the Washington Post that when the time came that they needed somebody to create words of Klingon for Star Trek III: The Search for Spock, they again called on the linguist. Klingon had actually already been spoken briefly, in the opening of Star Trek: The Motion Picture. In order to keep continuity with the first film, Okrand listened to the language used in that film and simply built on that, making sure the language sounded alien by combining sounds from different languages that didn't sound like they belonged together.
You listen to the lines in the first movie. That'll tell you what the sounds are. I added to it. These are not human; their language should not be recognizably human. But the people who are going to speak it, the actors, are human. So I added no sounds that you can't find in some human language or other, but you shouldn't find these sounds in the same language. It's unnatural. At the time I didn't know it was going to, you know, live long and prosper.