This repo contains the source code for generating the Youtube subtitles in multiple languages. The input file is a .vtt file. This is generated from Youtube video subtitle. The default language is English. This input file is converted to multiple languages uses Azure Cognitive service named Translator.
Follow the documentation to create a new instance of Translator service in Azure.
Retrieve the API key for Translator from Azure portal and store it in an environment variable.
I have used Powershell to add the environment variable. You can use any other approach to create an environment variable named TranslatorAPIkey
.
[System.Environment]::SetEnvironmentVariable('TranslatorAPIkey','YOUR__API__KEY', 'Machine')
If you are on MacOS, you can store the API key in the .bashrc or .zshrc file as an environment variable.
export TranslatorAPIKey="<<replace_with_your_PAI-key>>"
The subtitles are translated into the languages listed below. For the complete list of languages supported by the translator service, refer to the documentation.
Language code | Language name |
---|---|
af | Afrikaans |
sq | Albanian |
ar | Arabic |
hy | Armenian |
bn | Bangla |
bg | Bulgarian |
zh-Hans | ChineseSimplified |
hr | Croatian |
cs | Czek |
da | Danish |
nl | Dutch |
fil | Filipino |
fi | Finnish |
fr | French |
de | German |
el | Greek |
he | Hebrew |
hi | Hindi |
hu | Hungarian |
id | Indonesian |
ga | Irish |
it | Italian |
ja | Japanese |
ko | Korean |
ms | Malay |
my | Myanmar |
ne | Nepali |
nb | Norwegian |
fa | Persian |
pl | Polish |
pt-pt | Portuguese |
ro | Romanian |
ru | Russian |
es | Spanish |
sv | Swedish |
th | Thai |
tr | Turkish |
uk | Ukrainian |
vi | Vietnamese |
Follow the instructions in the YouTube Data API and create a project in the console
Watch the two YouTUbe videos listed below to know how to generate and upload subtitles in multiple languages.
How to generate Youtube subtitles in multiple languages using Microsoft Translator
How to programatically upload Youtube subtitles in multiple languages