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 ("\n Thanks... see u later! " )
46
+
47
+ main ()
0 commit comments