Пример #1
0
    def test_list_translation(self):
        translations = translator.translate(['The quick brown fox', 'jumps over', 'the lazy dog'],
            src='en', dest='ko')

        assert translations[0].text == u'빠른 갈색 여우'
        assert translations[1].text == u'이상 점프'
        assert translations[2].text == u'게으른 개'
Пример #2
0
    def test_list_translation(self):
        translations = translator.translate(
            ['The quick brown fox', 'jumps over', 'the lazy dog'],
            src='en',
            dest='ko')

        assert translations[0].text == u'빠른 갈색 여우'
        assert translations[1].text == u'이상 점프'
        assert translations[2].text == u'게으른 개'
Пример #3
0
#importing Google Translate API
import googletrans

#create translator class
from googletrans import translator

translator = Translator()

#translator automatically translates from whatever language to english
#so for our speech recognition code this could be under the Spanish recognized audio
result = translator.translate('whatever text to be translated here',
                              src='the source language')

#this code translates from english to spanish
result = translator.translate('whatever text file here', src='en', dest='es')
print(result.text)
Пример #4
0
 def test_unicode(self):
     result = translator.translate('안녕하세요.', src='ko', dest='ja')
     assert result.text == u'こんにちは。'
Пример #5
0
 def test_latin_to_english(self):
     result = translator.translate('veritas lux mea', src='la', dest='en')
     assert result.text == 'The truth is my light'
Пример #6
0
 def test_unicode(self):
     result = translator.translate('안녕하세요.', src='ko', dest='ja')
     assert result.text == u'こんにちは。'
Пример #7
0
 def test_latin_to_english(self):
     result = translator.translate('veritas lux mea', src='la', dest='en')
     assert result.text == 'The truth is my light'
Пример #8
0
def translation():
    word = entry.get()
    translator = Translator(service_urls = ['translate.google.com '])
    translation1 = translator.translate(word,dest ='ru')
    labe1 = tk.label(win, text=f"Translated in russian : {translation1.text}",bg = "yellow")
    label1.grid(row =2, column = 0)