Skip to content

Commit 2c7aee8

Browse files
committed
unified list of languages for google translate
1 parent 919c691 commit 2c7aee8

File tree

1 file changed

+140
-55
lines changed

1 file changed

+140
-55
lines changed

apps/sim/blocks/blocks/google_translate.ts

Lines changed: 140 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,142 @@
11
import { GoogleTranslateIcon } from '@/components/icons'
22
import { AuthMode, type BlockConfig } from '@/blocks/types'
33

4+
const SUPPORTED_LANGUAGES = [
5+
{ label: 'Afrikaans', id: 'af' },
6+
{ label: 'Albanian', id: 'sq' },
7+
{ label: 'Amharic', id: 'am' },
8+
{ label: 'Arabic', id: 'ar' },
9+
{ label: 'Armenian', id: 'hy' },
10+
{ label: 'Assamese', id: 'as' },
11+
{ label: 'Aymara', id: 'ay' },
12+
{ label: 'Azerbaijani', id: 'az' },
13+
{ label: 'Bambara', id: 'bm' },
14+
{ label: 'Basque', id: 'eu' },
15+
{ label: 'Belarusian', id: 'be' },
16+
{ label: 'Bengali', id: 'bn' },
17+
{ label: 'Bhojpuri', id: 'bho' },
18+
{ label: 'Bosnian', id: 'bs' },
19+
{ label: 'Bulgarian', id: 'bg' },
20+
{ label: 'Catalan', id: 'ca' },
21+
{ label: 'Cebuano', id: 'ceb' },
22+
{ label: 'Chinese (Simplified)', id: 'zh-CN' },
23+
{ label: 'Chinese (Traditional)', id: 'zh-TW' },
24+
{ label: 'Corsican', id: 'co' },
25+
{ label: 'Croatian', id: 'hr' },
26+
{ label: 'Czech', id: 'cs' },
27+
{ label: 'Danish', id: 'da' },
28+
{ label: 'Dhivehi', id: 'dv' },
29+
{ label: 'Dogri', id: 'doi' },
30+
{ label: 'Dutch', id: 'nl' },
31+
{ label: 'English', id: 'en' },
32+
{ label: 'Esperanto', id: 'eo' },
33+
{ label: 'Estonian', id: 'et' },
34+
{ label: 'Ewe', id: 'ee' },
35+
{ label: 'Filipino', id: 'tl' },
36+
{ label: 'Finnish', id: 'fi' },
37+
{ label: 'French', id: 'fr' },
38+
{ label: 'Frisian', id: 'fy' },
39+
{ label: 'Galician', id: 'gl' },
40+
{ label: 'Georgian', id: 'ka' },
41+
{ label: 'German', id: 'de' },
42+
{ label: 'Greek', id: 'el' },
43+
{ label: 'Guarani', id: 'gn' },
44+
{ label: 'Gujarati', id: 'gu' },
45+
{ label: 'Haitian Creole', id: 'ht' },
46+
{ label: 'Hausa', id: 'ha' },
47+
{ label: 'Hawaiian', id: 'haw' },
48+
{ label: 'Hebrew', id: 'he' },
49+
{ label: 'Hindi', id: 'hi' },
50+
{ label: 'Hmong', id: 'hmn' },
51+
{ label: 'Hungarian', id: 'hu' },
52+
{ label: 'Icelandic', id: 'is' },
53+
{ label: 'Igbo', id: 'ig' },
54+
{ label: 'Ilocano', id: 'ilo' },
55+
{ label: 'Indonesian', id: 'id' },
56+
{ label: 'Irish', id: 'ga' },
57+
{ label: 'Italian', id: 'it' },
58+
{ label: 'Japanese', id: 'ja' },
59+
{ label: 'Javanese', id: 'jv' },
60+
{ label: 'Kannada', id: 'kn' },
61+
{ label: 'Kazakh', id: 'kk' },
62+
{ label: 'Khmer', id: 'km' },
63+
{ label: 'Kinyarwanda', id: 'rw' },
64+
{ label: 'Konkani', id: 'gom' },
65+
{ label: 'Korean', id: 'ko' },
66+
{ label: 'Krio', id: 'kri' },
67+
{ label: 'Kurdish', id: 'ku' },
68+
{ label: 'Kurdish (Sorani)', id: 'ckb' },
69+
{ label: 'Kyrgyz', id: 'ky' },
70+
{ label: 'Lao', id: 'lo' },
71+
{ label: 'Latin', id: 'la' },
72+
{ label: 'Latvian', id: 'lv' },
73+
{ label: 'Lingala', id: 'ln' },
74+
{ label: 'Lithuanian', id: 'lt' },
75+
{ label: 'Luganda', id: 'lg' },
76+
{ label: 'Luxembourgish', id: 'lb' },
77+
{ label: 'Macedonian', id: 'mk' },
78+
{ label: 'Maithili', id: 'mai' },
79+
{ label: 'Malagasy', id: 'mg' },
80+
{ label: 'Malay', id: 'ms' },
81+
{ label: 'Malayalam', id: 'ml' },
82+
{ label: 'Maltese', id: 'mt' },
83+
{ label: 'Maori', id: 'mi' },
84+
{ label: 'Marathi', id: 'mr' },
85+
{ label: 'Meiteilon (Manipuri)', id: 'mni-Mtei' },
86+
{ label: 'Mizo', id: 'lus' },
87+
{ label: 'Mongolian', id: 'mn' },
88+
{ label: 'Myanmar (Burmese)', id: 'my' },
89+
{ label: 'Nepali', id: 'ne' },
90+
{ label: 'Norwegian', id: 'no' },
91+
{ label: 'Nyanja (Chichewa)', id: 'ny' },
92+
{ label: 'Odia (Oriya)', id: 'or' },
93+
{ label: 'Oromo', id: 'om' },
94+
{ label: 'Pashto', id: 'ps' },
95+
{ label: 'Persian', id: 'fa' },
96+
{ label: 'Polish', id: 'pl' },
97+
{ label: 'Portuguese', id: 'pt' },
98+
{ label: 'Punjabi', id: 'pa' },
99+
{ label: 'Quechua', id: 'qu' },
100+
{ label: 'Romanian', id: 'ro' },
101+
{ label: 'Russian', id: 'ru' },
102+
{ label: 'Samoan', id: 'sm' },
103+
{ label: 'Sanskrit', id: 'sa' },
104+
{ label: 'Scots Gaelic', id: 'gd' },
105+
{ label: 'Sepedi', id: 'nso' },
106+
{ label: 'Serbian', id: 'sr' },
107+
{ label: 'Sesotho', id: 'st' },
108+
{ label: 'Shona', id: 'sn' },
109+
{ label: 'Sindhi', id: 'sd' },
110+
{ label: 'Sinhala', id: 'si' },
111+
{ label: 'Slovak', id: 'sk' },
112+
{ label: 'Slovenian', id: 'sl' },
113+
{ label: 'Somali', id: 'so' },
114+
{ label: 'Spanish', id: 'es' },
115+
{ label: 'Sundanese', id: 'su' },
116+
{ label: 'Swahili', id: 'sw' },
117+
{ label: 'Swedish', id: 'sv' },
118+
{ label: 'Tajik', id: 'tg' },
119+
{ label: 'Tamil', id: 'ta' },
120+
{ label: 'Tatar', id: 'tt' },
121+
{ label: 'Telugu', id: 'te' },
122+
{ label: 'Thai', id: 'th' },
123+
{ label: 'Tigrinya', id: 'ti' },
124+
{ label: 'Tsonga', id: 'ts' },
125+
{ label: 'Turkish', id: 'tr' },
126+
{ label: 'Turkmen', id: 'tk' },
127+
{ label: 'Twi (Akan)', id: 'ak' },
128+
{ label: 'Ukrainian', id: 'uk' },
129+
{ label: 'Urdu', id: 'ur' },
130+
{ label: 'Uyghur', id: 'ug' },
131+
{ label: 'Uzbek', id: 'uz' },
132+
{ label: 'Vietnamese', id: 'vi' },
133+
{ label: 'Welsh', id: 'cy' },
134+
{ label: 'Xhosa', id: 'xh' },
135+
{ label: 'Yiddish', id: 'yi' },
136+
{ label: 'Yoruba', id: 'yo' },
137+
{ label: 'Zulu', id: 'zu' },
138+
] as const
139+
4140
export const GoogleTranslateBlock: BlockConfig = {
5141
type: 'google_translate',
6142
name: 'Google Translate',
@@ -35,42 +171,8 @@ export const GoogleTranslateBlock: BlockConfig = {
35171
title: 'Target Language',
36172
type: 'dropdown',
37173
condition: { field: 'operation', value: 'text' },
38-
options: [
39-
{ label: 'English', id: 'en' },
40-
{ label: 'Spanish', id: 'es' },
41-
{ label: 'French', id: 'fr' },
42-
{ label: 'German', id: 'de' },
43-
{ label: 'Italian', id: 'it' },
44-
{ label: 'Portuguese', id: 'pt' },
45-
{ label: 'Russian', id: 'ru' },
46-
{ label: 'Japanese', id: 'ja' },
47-
{ label: 'Korean', id: 'ko' },
48-
{ label: 'Chinese (Simplified)', id: 'zh-CN' },
49-
{ label: 'Chinese (Traditional)', id: 'zh-TW' },
50-
{ label: 'Arabic', id: 'ar' },
51-
{ label: 'Hindi', id: 'hi' },
52-
{ label: 'Turkish', id: 'tr' },
53-
{ label: 'Dutch', id: 'nl' },
54-
{ label: 'Polish', id: 'pl' },
55-
{ label: 'Swedish', id: 'sv' },
56-
{ label: 'Thai', id: 'th' },
57-
{ label: 'Vietnamese', id: 'vi' },
58-
{ label: 'Indonesian', id: 'id' },
59-
{ label: 'Ukrainian', id: 'uk' },
60-
{ label: 'Czech', id: 'cs' },
61-
{ label: 'Greek', id: 'el' },
62-
{ label: 'Hebrew', id: 'he' },
63-
{ label: 'Romanian', id: 'ro' },
64-
{ label: 'Hungarian', id: 'hu' },
65-
{ label: 'Danish', id: 'da' },
66-
{ label: 'Finnish', id: 'fi' },
67-
{ label: 'Norwegian', id: 'no' },
68-
{ label: 'Bengali', id: 'bn' },
69-
{ label: 'Malay', id: 'ms' },
70-
{ label: 'Filipino', id: 'tl' },
71-
{ label: 'Swahili', id: 'sw' },
72-
{ label: 'Urdu', id: 'ur' },
73-
],
174+
searchable: true,
175+
options: SUPPORTED_LANGUAGES,
74176
value: () => 'es',
75177
required: { field: 'operation', value: 'text' },
76178
},
@@ -79,25 +181,8 @@ export const GoogleTranslateBlock: BlockConfig = {
79181
title: 'Source Language',
80182
type: 'dropdown',
81183
condition: { field: 'operation', value: 'text' },
82-
options: [
83-
{ label: 'Auto-detect', id: '' },
84-
{ label: 'English', id: 'en' },
85-
{ label: 'Spanish', id: 'es' },
86-
{ label: 'French', id: 'fr' },
87-
{ label: 'German', id: 'de' },
88-
{ label: 'Italian', id: 'it' },
89-
{ label: 'Portuguese', id: 'pt' },
90-
{ label: 'Russian', id: 'ru' },
91-
{ label: 'Japanese', id: 'ja' },
92-
{ label: 'Korean', id: 'ko' },
93-
{ label: 'Chinese (Simplified)', id: 'zh-CN' },
94-
{ label: 'Chinese (Traditional)', id: 'zh-TW' },
95-
{ label: 'Arabic', id: 'ar' },
96-
{ label: 'Hindi', id: 'hi' },
97-
{ label: 'Turkish', id: 'tr' },
98-
{ label: 'Dutch', id: 'nl' },
99-
{ label: 'Polish', id: 'pl' },
100-
],
184+
searchable: true,
185+
options: [{ label: 'Auto-detect', id: '' }, ...SUPPORTED_LANGUAGES],
101186
value: () => '',
102187
},
103188
{

0 commit comments

Comments
 (0)