fix(client): pronunciation is None for some languages (#175)

This commit is contained in:
SuHun Han 2020-06-09 09:35:17 +09:00
parent 704e8617a0
commit 312f36ad87
2 changed files with 12 additions and 0 deletions

View File

@ -186,6 +186,12 @@ class Translator:
except Exception: # pragma: nocover
pass
if pron is None:
try:
pron = data[0][1][2]
except: # pragma: nocover
pass
if dest in EXCLUDES and pron == origin:
pron = translated

View File

@ -29,6 +29,12 @@ def test_pronunciation(translator):
assert result.pronunciation == 'Kon\'nichiwa.'
def test_pronunciation_issue_175(translator):
result = translator.translate('Hello', src='en', dest='ru')
assert result.pronunciation is not None
def test_latin_to_english(translator):
result = translator.translate('veritas lux mea', src='la', dest='en')
assert result.text == 'The truth is my light'