ModuleTranslate.py
343 Bytes
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os
sys.path.append(os.getcwd()+"/tradutor/src/py")
#sys.path.append(os.path.expanduser("~/gtaaas/tradutor/src/py"))
from Tradutor import *
tradutor = Tradutor()
def iniciar(x):
try:
text = x.decode("utf-8")
except:
text = x.decode("iso-8859-1")
return tradutor.traduzir(text)