prataffel commited on
Commit
f63e255
·
1 Parent(s): 2316fd5

Fix #6 unsing the first entry of the complete list

Browse files
Files changed (1) hide show
  1. deep_translator/pons.py +2 -2
deep_translator/pons.py CHANGED
@@ -75,12 +75,12 @@ class PonsTranslator(BaseTranslator):
75
  if e.parent.name == 'div':
76
  if e and "/translate/{}-{}/".format(self._target, self._source) in e.get('href'):
77
  temp += e.get_text() + ' '
78
- if not kwargs.get('return_all'):
79
- return temp
80
  eof.append(temp)
81
 
82
  if 'return_all' in kwargs and kwargs.get('return_all'):
83
  return [word for word in eof if word and len(word) > 1]
 
 
84
 
85
  def translate_words(self, words, **kwargs):
86
  if not words:
 
75
  if e.parent.name == 'div':
76
  if e and "/translate/{}-{}/".format(self._target, self._source) in e.get('href'):
77
  temp += e.get_text() + ' '
 
 
78
  eof.append(temp)
79
 
80
  if 'return_all' in kwargs and kwargs.get('return_all'):
81
  return [word for word in eof if word and len(word) > 1]
82
+ else:
83
+ return [word for word in eof if word and len(word) > 1][0]
84
 
85
  def translate_words(self, words, **kwargs):
86
  if not words: