-
Notifications
You must be signed in to change notification settings - Fork 4
/
languages.py
52 lines (48 loc) · 1.17 KB
/
languages.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Define the key mapping in English
key_mapping_english = {
"up": "z",
"down": "x",
"left": "c",
"right": "v",
"buttona": "a",
"buttonb": "b",
"start": "m",
"select": "l"
}
# Define the key mapping in Spanish
key_mapping_spanish = {
"arriba": "z",
"abajo": "x",
"izquierda": "c",
"derecha": "v",
"botona": "a",
"botonb": "b",
"start": "m",
"select": "l"
}
# Define the key mapping in Portuguese
key_mapping_portuguese = {
"cima": "z",
"baixo": "x",
"esquerda": "c",
"direita": "v",
"botaoa": "a",
"botaob": "b",
"iniciar": "m",
"selecionar": "l"
}
# Function to detect the language based on the comment
def detect_language(comment):
# Lists of keywords for each language
comment = comment.lower()
for key in key_mapping_english.keys():
if comment in key:
return "english"
for key in key_mapping_spanish.keys():
if comment in key:
return "spanish"
for key in key_mapping_portuguese.keys():
if comment in key:
return "portuguese"
else:
return "error" # Use english <3 as the default if no language is detected