How to use the googletrans.translator.translate function in googletrans

To help you get started, we’ve selected a few googletrans examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ssut / py-googletrans / tests.py View on Github external
def test_latin_to_english(self):
        result = translator.translate('veritas lux mea', src='la', dest='en')
        assert result.text == 'The truth is my light'
github ssut / py-googletrans / tests.py View on Github external
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'게으른 개'
github ssut / py-googletrans / tests.py View on Github external
def test_unicode(self):
        result = translator.translate('안녕하세요.', src='ko', dest='ja')
        assert result.text == u'こんにちは。'