-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtranslation.py
71 lines (47 loc) · 1.71 KB
/
translation.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#........................TRAMA....................
'''
The goal of the program:
words Translator of Text with just one click on text work in python sheel.
(in sheel of python)
Programmer :
Ahmadali Jamali
11.03.2021
Teheran
'''
#Start.....
#libraries
import pyautogui as pya
import pyperclip
import time
from googletrans import Translator, constants
from pprint import pprint
import pyautogui as pya
#class
translator = Translator()
#functions:
def copy_clipboard():
pya.hotkey('ctrl', 'c')
time.sleep(.01) # ctrl-c is usually very fast but your program may execute faster
return pyperclip.paste()
# double clicks on a position of the cursor
#********************************API***********************************#
#***.........................Input/Output...........................***#
#the Input output of the cmd:
if __name__ == '__main__':
while True:
#fw=open('Text_Translatore.txt','a')
#input('press enter any key')
pya.doubleClick(pya.position())
var = copy_clipboard()
#string = str(input('Write your comment:\n'))
translation = translator.translate(str(var),dest="fa")
y = f"{translation.origin} ({translation.src}) : {translation.text} ({translation.dest})"
print(y)
print('\n')
#fw.write(str(y))
#fw.write("\n")
#fw.write("=========================================\n")
#fw.close()
input('Press enter to serach next text:\n')
input()
#End