musfiqdehan's picture
Add target language dictionary and select target language code
9583ddb
target_lang_dict = {
"Afrikaans": "af",
"Albanian": "sq",
"Arabic": "ar",
"Aragonese": "an",
"Armenian": "hy",
"Asturian": "ast",
"Azerbaijani": "az",
"Bashkir": "ba",
"Basque": "eu",
"Bavarian": "bar",
"Belarusian": "be",
"Bengali": "bn",
"Bishnupriya Manipuri": "bpy",
"Bosnian": "bs",
"Breton": "br",
"Bulgarian": "bg",
"Burmese": "my",
"Catalan": "ca",
"Cebuano": "ceb",
"Chechen": "ce",
"Chinese (Simplified)": "zh",
"Chinese (Traditional)": "zh-tw",
"Chuvash": "cv",
"Croatian": "hr",
"Czech": "cs",
"Danish": "da",
"Dutch": "nl",
"English": "en",
"Estonian": "et",
"Finnish": "fi",
"French": "fr",
"Galician": "gl",
"Georgian": "ka",
"German": "de",
"Greek": "el",
"Gujarati": "gu",
"Haitian": "ht",
"Hebrew": "he",
"Hindi": "hi",
"Hungarian": "hu",
"Icelandic": "is",
"Ido": "io",
"Indonesian": "id",
"Irish": "ga",
"Italian": "it",
"Japanese": "ja",
"Javanese": "jv",
"Kannada": "kn",
"Kazakh": "kk",
"Kirghiz": "ky",
"Korean": "ko",
"Latin": "la",
"Latvian": "lv",
"Lithuanian": "lt",
"Lombard": "lmo",
"Low Saxon": "nds",
"Luxembourgish": "lb",
"Macedonian": "mk",
"Malagasy": "mg",
"Malay": "ms",
"Malayalam": "ml",
"Marathi": "mr",
"Minangkabau": "min",
"Nepali": "ne",
"Newar": "new",
"Norwegian (Bokmal)": "nb",
"Norwegian (Nynorsk)": "nn",
"Occitan": "oc",
"Persian (Farsi)": "fa",
"Piedmontese": "pms",
"Polish": "pl",
"Portuguese": "pt",
"Punjabi": "pa",
"Romanian": "ro",
"Russian": "ru",
"Scots": "sco",
"Serbian": "sr",
"Serbo-Croatian": "sh",
"Sicilian": "scn",
"Slovak": "sk",
"Slovenian": "sl",
"South Azerbaijani": "azb",
"Spanish": "es",
"Sundanese": "su",
"Swahili": "sw",
"Swedish": "sv",
"Tagalog": "tl",
"Tajik": "tg",
"Tamil": "ta",
"Tatar": "tt",
"Telugu": "te",
"Turkish": "tr",
"Ukrainian": "uk",
"Urdu": "ur",
"Uzbek": "uz",
"Vietnamese": "vi",
"Volapük": "vo",
"Waray-Waray": "war",
"Welsh": "cy",
"West Frisian": "fy",
"Western Punjabi": "pnb",
"Yoruba": "yo",
"Thai": "th",
"Mongolian": "mn"
}
def select_target_lang_code(lang):
"""
Select the target language code
"""
return target_lang_dict[lang] if lang in target_lang_dict else "en"
lang = select_target_lang_code("Hindi")
print(lang)