This repository demonstrates how to use the Palabra API for real-time speech-to-speech translation from English to Spanish using TypeScript (JavaScript).
It provides ~/src/main.ts file with clear and step-by-step code examples (relevant to the Palabra WebRTC Quick Start Guide). The repository allows to build the project locally with just a few simple commands, enabling you to experience real-time translation of your own speech directly in your browser.
- Node 18+
- pnpm
- Clone the repository
- Create a new
.envfile in the root directory of the project. - Add the Palabra Credentials to the following environment variables in the
.envfile:
VITE_PALABRA_CLIENT_ID=<Your_Client_ID>
VITE_PALABRA_CLIENT_SECRET=<Your_Client_Secret>- Run
pnpm install - Run
pnpm dev
The application will be available at http://localhost:5173/ by default.
While this demo is pre-configurated to translate from English to Spanish, Palabra Palabra API supports a wide range of languages for speech recognition and translation:
Speech Recognition: 🇸🇦 Arabic, 🇨🇳 Chinese, 🇨🇿 Czech, 🇩🇰 Danish, 🇳🇱 Dutch, 🇬🇧 English, 🇫🇮 Finnish, 🇫🇷 French, 🇩🇪 German, 🇬🇷 Greek, 🇮🇱 Hebrew, 🇮🇳 Hindi, 🇭🇺 Hungarian, 🇮🇹 Italian, 🇯🇵 Japanese, 🇰🇷 Korean, 🇵🇱 Polish, 🇵🇹 Portuguese, 🇷🇺 Russian, 🇪🇸 Spanish, 🇹🇷 Turkish, 🇺🇦 Ukrainian
Translation: 🇸🇦 Arabic, 🇧🇬 Bulgarian, 🇨🇳 Chinese (Mandarin), 🇨🇳 Chinese (Cantonese), 🇨🇿 Czech, 🇩🇰 Danish, 🇳🇱 Dutch, 🇬🇧 English (United Kingdom), 🇺🇸 English (United States), 🇫🇮 Finnish, 🇫🇷 French, 🇩🇪 German, 🇬🇷 Greek, 🇮🇱 Hebrew, 🇮🇳 Hindi, 🇭🇺 Hungarian, 🇮🇩 Indonesian, 🇮🇹 Italian, 🇯🇵 Japanese, 🇰🇷 Korean, 🇵🇱 Polish, 🇵🇹 Portuguese, 🇵🇹 Portuguese (Brazilian), 🇷🇴 Romanian, 🇷🇺 Russian, 🇸🇰 Slovak, 🇪🇸 Spanish, 🇸🇪 Swedish, 🇹🇷 Turkish, 🇺🇦 Ukrainian
View the full language table.
If you wish to change English-to-Spanish translation languages, check the @/src/config/translation.config.ts file. You can change the source_language and target_language values for any other supported language codes.
