Merge remote-tracking branch 'upstream/master' into master
Browse files- README.rst +6 -2
- deep_translator/__init__.py +1 -1
- deep_translator/pons.py +3 -5
- examples/linguee.py +7 -0
- examples/pons.py +7 -0
- setup.cfg +1 -1
- setup.py +1 -1
README.rst
CHANGED
@@ -102,13 +102,17 @@ Usage
|
|
102 |
|
103 |
.. code-block:: python
|
104 |
|
105 |
-
from deep_translator import GoogleTranslator,
|
|
|
|
|
|
|
|
|
106 |
|
107 |
|
108 |
|
109 |
.. note::
|
110 |
|
111 |
-
You can check the supported languages of
|
112 |
get_supported_languages function as a static method.
|
113 |
|
114 |
- Example of checking the supported languages for the google translator:
|
|
|
102 |
|
103 |
.. code-block:: python
|
104 |
|
105 |
+
from deep_translator import (GoogleTranslator,
|
106 |
+
PonsTranslator,
|
107 |
+
LingueeTranslator,
|
108 |
+
MyMemoryTranslator,
|
109 |
+
detect_language)
|
110 |
|
111 |
|
112 |
|
113 |
.. note::
|
114 |
|
115 |
+
You can check the supported languages of each translator by calling the
|
116 |
get_supported_languages function as a static method.
|
117 |
|
118 |
- Example of checking the supported languages for the google translator:
|
deep_translator/__init__.py
CHANGED
@@ -9,7 +9,7 @@ from .detection import detect_language
|
|
9 |
|
10 |
__author__ = """Nidhal Baccouri"""
|
11 |
__email__ = '[email protected]'
|
12 |
-
__version__ = '1.1.
|
13 |
|
14 |
__all__ = [GoogleTranslator,
|
15 |
PonsTranslator,
|
|
|
9 |
|
10 |
__author__ = """Nidhal Baccouri"""
|
11 |
__email__ = '[email protected]'
|
12 |
+
__version__ = '1.1.4'
|
13 |
|
14 |
__all__ = [GoogleTranslator,
|
15 |
PonsTranslator,
|
deep_translator/pons.py
CHANGED
@@ -57,7 +57,7 @@ class PonsTranslator(BaseTranslator):
|
|
57 |
raise LanguageNotSupportedException(lang)
|
58 |
return True
|
59 |
|
60 |
-
def translate(self, word, **kwargs):
|
61 |
|
62 |
if self._validate_payload(word):
|
63 |
url = "{}{}-{}/{}".format(self.__base_url, self._source, self._target, word)
|
@@ -77,10 +77,8 @@ class PonsTranslator(BaseTranslator):
|
|
77 |
temp += e.get_text() + ' '
|
78 |
eof.append(temp)
|
79 |
|
80 |
-
|
81 |
-
|
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:
|
|
|
57 |
raise LanguageNotSupportedException(lang)
|
58 |
return True
|
59 |
|
60 |
+
def translate(self, word, return_all=False, **kwargs):
|
61 |
|
62 |
if self._validate_payload(word):
|
63 |
url = "{}{}-{}/{}".format(self.__base_url, self._source, self._target, word)
|
|
|
77 |
temp += e.get_text() + ' '
|
78 |
eof.append(temp)
|
79 |
|
80 |
+
word_list = [word for word in eof if word and len(word) > 1]
|
81 |
+
return word_list if return_all else word_list[0]
|
|
|
|
|
82 |
|
83 |
def translate_words(self, words, **kwargs):
|
84 |
if not words:
|
examples/linguee.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from deep_translator import LingueeTranslator
|
3 |
+
|
4 |
+
|
5 |
+
res = LingueeTranslator(source='de', target='en').translate('laufen', return_all=False)
|
6 |
+
|
7 |
+
print(res)
|
examples/pons.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from deep_translator import PonsTranslator
|
3 |
+
|
4 |
+
|
5 |
+
res = PonsTranslator(source='de', target='en').translate('übersetzen', return_all=False)
|
6 |
+
|
7 |
+
print(res)
|
setup.cfg
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
[bumpversion]
|
2 |
-
current_version = 1.1.
|
3 |
commit = True
|
4 |
tag = True
|
5 |
|
|
|
1 |
[bumpversion]
|
2 |
+
current_version = 1.1.4
|
3 |
commit = True
|
4 |
tag = True
|
5 |
|
setup.py
CHANGED
@@ -51,6 +51,6 @@ setup(
|
|
51 |
test_suite='tests',
|
52 |
tests_require=test_requirements,
|
53 |
url='https://github.com/nidhaloff/deep_translator',
|
54 |
-
version='1.1.
|
55 |
zip_safe=False,
|
56 |
)
|
|
|
51 |
test_suite='tests',
|
52 |
tests_require=test_requirements,
|
53 |
url='https://github.com/nidhaloff/deep_translator',
|
54 |
+
version='1.1.4',
|
55 |
zip_safe=False,
|
56 |
)
|