Skip to content

Commit f4b52da

Browse files
authored
Add files via upload
1 parent 8a3c7a5 commit f4b52da

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

translator.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/python
2+
#-*- coding: utf-8 -*-
3+
__author__ = '9aylas'
4+
__bof__ = '19/03/2019 - 00:00'
5+
__eof__ = '20/03/2019 - 23:54'
6+
7+
import os
8+
from googletrans import Translator as t
9+
from PIL import Image as IMG, ImageDraw as IMGD, ImageFont as IMFont
10+
11+
12+
def logo():
13+
HelloWorld = ' Google TransLate '
14+
ifont = IMFont.truetype('arial.ttf',13)
15+
size = ifont.getsize(HelloWorld)
16+
image = IMG.new('1', size, 1)
17+
draw = IMGD.Draw(image)
18+
draw.text((0, 0), HelloWorld, ifont=ifont)
19+
for rownum in range(size[1]):
20+
line = []
21+
for colnum in range(size[0]):
22+
if image.getpixel((colnum, rownum)): line.append(' '),
23+
else: line.append(','),
24+
print(''.join(line))
25+
26+
def main():
27+
os.system("cls & color 1a")
28+
logo()
29+
print('\n')
30+
translator = t()
31+
text = input('# Gimme your Text :\n' + ' _'*33 + '\n [*] ')
32+
print(" -"*33)
33+
ds = input('\n# Your Language | Ex: en, es, ru...etc : \n# ')
34+
target = translator.translate(text, dest=ds) ## auto detector
35+
final = target.text
36+
print('\n* From "' + target.src + '" To --> "' + target.dest+'" ~')
37+
print(" _"*33)
38+
print(' [*] '+ final)
39+
print(" -"*33)
40+
again = input('\n * Translate again (y/n) ?\n*_ ')
41+
if again == "Y" or again == "y":
42+
os.system("cls & color 1a")
43+
main()
44+
else:
45+
print("\nThanks... see u later! ")
46+
47+
main()

0 commit comments

Comments
 (0)