Spaces:
Runtime error
Runtime error
musfiqdehan
commited on
Commit
•
9583ddb
1
Parent(s):
e6fb89b
Add target language dictionary and select target language code
Browse files
test.py
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
target_lang_dict = {
|
2 |
+
"Afrikaans": "af",
|
3 |
+
"Albanian": "sq",
|
4 |
+
"Arabic": "ar",
|
5 |
+
"Aragonese": "an",
|
6 |
+
"Armenian": "hy",
|
7 |
+
"Asturian": "ast",
|
8 |
+
"Azerbaijani": "az",
|
9 |
+
"Bashkir": "ba",
|
10 |
+
"Basque": "eu",
|
11 |
+
"Bavarian": "bar",
|
12 |
+
"Belarusian": "be",
|
13 |
+
"Bengali": "bn",
|
14 |
+
"Bishnupriya Manipuri": "bpy",
|
15 |
+
"Bosnian": "bs",
|
16 |
+
"Breton": "br",
|
17 |
+
"Bulgarian": "bg",
|
18 |
+
"Burmese": "my",
|
19 |
+
"Catalan": "ca",
|
20 |
+
"Cebuano": "ceb",
|
21 |
+
"Chechen": "ce",
|
22 |
+
"Chinese (Simplified)": "zh",
|
23 |
+
"Chinese (Traditional)": "zh-tw",
|
24 |
+
"Chuvash": "cv",
|
25 |
+
"Croatian": "hr",
|
26 |
+
"Czech": "cs",
|
27 |
+
"Danish": "da",
|
28 |
+
"Dutch": "nl",
|
29 |
+
"English": "en",
|
30 |
+
"Estonian": "et",
|
31 |
+
"Finnish": "fi",
|
32 |
+
"French": "fr",
|
33 |
+
"Galician": "gl",
|
34 |
+
"Georgian": "ka",
|
35 |
+
"German": "de",
|
36 |
+
"Greek": "el",
|
37 |
+
"Gujarati": "gu",
|
38 |
+
"Haitian": "ht",
|
39 |
+
"Hebrew": "he",
|
40 |
+
"Hindi": "hi",
|
41 |
+
"Hungarian": "hu",
|
42 |
+
"Icelandic": "is",
|
43 |
+
"Ido": "io",
|
44 |
+
"Indonesian": "id",
|
45 |
+
"Irish": "ga",
|
46 |
+
"Italian": "it",
|
47 |
+
"Japanese": "ja",
|
48 |
+
"Javanese": "jv",
|
49 |
+
"Kannada": "kn",
|
50 |
+
"Kazakh": "kk",
|
51 |
+
"Kirghiz": "ky",
|
52 |
+
"Korean": "ko",
|
53 |
+
"Latin": "la",
|
54 |
+
"Latvian": "lv",
|
55 |
+
"Lithuanian": "lt",
|
56 |
+
"Lombard": "lmo",
|
57 |
+
"Low Saxon": "nds",
|
58 |
+
"Luxembourgish": "lb",
|
59 |
+
"Macedonian": "mk",
|
60 |
+
"Malagasy": "mg",
|
61 |
+
"Malay": "ms",
|
62 |
+
"Malayalam": "ml",
|
63 |
+
"Marathi": "mr",
|
64 |
+
"Minangkabau": "min",
|
65 |
+
"Nepali": "ne",
|
66 |
+
"Newar": "new",
|
67 |
+
"Norwegian (Bokmal)": "nb",
|
68 |
+
"Norwegian (Nynorsk)": "nn",
|
69 |
+
"Occitan": "oc",
|
70 |
+
"Persian (Farsi)": "fa",
|
71 |
+
"Piedmontese": "pms",
|
72 |
+
"Polish": "pl",
|
73 |
+
"Portuguese": "pt",
|
74 |
+
"Punjabi": "pa",
|
75 |
+
"Romanian": "ro",
|
76 |
+
"Russian": "ru",
|
77 |
+
"Scots": "sco",
|
78 |
+
"Serbian": "sr",
|
79 |
+
"Serbo-Croatian": "sh",
|
80 |
+
"Sicilian": "scn",
|
81 |
+
"Slovak": "sk",
|
82 |
+
"Slovenian": "sl",
|
83 |
+
"South Azerbaijani": "azb",
|
84 |
+
"Spanish": "es",
|
85 |
+
"Sundanese": "su",
|
86 |
+
"Swahili": "sw",
|
87 |
+
"Swedish": "sv",
|
88 |
+
"Tagalog": "tl",
|
89 |
+
"Tajik": "tg",
|
90 |
+
"Tamil": "ta",
|
91 |
+
"Tatar": "tt",
|
92 |
+
"Telugu": "te",
|
93 |
+
"Turkish": "tr",
|
94 |
+
"Ukrainian": "uk",
|
95 |
+
"Urdu": "ur",
|
96 |
+
"Uzbek": "uz",
|
97 |
+
"Vietnamese": "vi",
|
98 |
+
"Volapük": "vo",
|
99 |
+
"Waray-Waray": "war",
|
100 |
+
"Welsh": "cy",
|
101 |
+
"West Frisian": "fy",
|
102 |
+
"Western Punjabi": "pnb",
|
103 |
+
"Yoruba": "yo",
|
104 |
+
"Thai": "th",
|
105 |
+
"Mongolian": "mn"
|
106 |
+
}
|
107 |
+
|
108 |
+
def select_target_lang_code(lang):
|
109 |
+
"""
|
110 |
+
Select the target language code
|
111 |
+
"""
|
112 |
+
return target_lang_dict[lang] if lang in target_lang_dict else "en"
|
113 |
+
|
114 |
+
lang = select_target_lang_code("Hindi")
|
115 |
+
|
116 |
+
print(lang)
|