Nidhal Baccouri
commited on
Commit
·
9450a60
1
Parent(s):
a22d18a
cleanup and updated readme
Browse files- deep_translator/google.py +0 -6
- deep_translator/libre.py +0 -6
- docs/README.rst +27 -0
deep_translator/google.py
CHANGED
|
@@ -118,9 +118,3 @@ class GoogleTranslator(BaseTranslator):
|
|
| 118 |
@return: list of translations
|
| 119 |
"""
|
| 120 |
return self._translate_batch(batch, **kwargs)
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
if __name__ == "__main__":
|
| 124 |
-
trans = GoogleTranslator(source="auto", target="de")
|
| 125 |
-
res = trans.translate_file(path='/home/nidhal/Documents/translate.pdf')
|
| 126 |
-
print("translation: ", res)
|
|
|
|
| 118 |
@return: list of translations
|
| 119 |
"""
|
| 120 |
return self._translate_batch(batch, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deep_translator/libre.py
CHANGED
|
@@ -108,9 +108,3 @@ class LibreTranslator(BaseTranslator):
|
|
| 108 |
@return: list of translations
|
| 109 |
"""
|
| 110 |
return self._translate_batch(batch, **kwargs)
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
if __name__ == "__main__":
|
| 114 |
-
l = LibreTranslator(source="en", target="de")
|
| 115 |
-
res = l.translate("good")
|
| 116 |
-
print("res: ", res)
|
|
|
|
| 108 |
@return: list of translations
|
| 109 |
"""
|
| 110 |
return self._translate_batch(batch, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/README.rst
CHANGED
|
@@ -114,6 +114,8 @@ Features
|
|
| 114 |
* Automatic single language detection
|
| 115 |
* Batch language detection
|
| 116 |
* Translate directly from a text file
|
|
|
|
|
|
|
| 117 |
* Get multiple translation for a word
|
| 118 |
* Automate the translation of different paragraphs in different languages
|
| 119 |
* Translate directly from terminal (version >= 1.1.0)
|
|
@@ -130,6 +132,14 @@ Install the stable release:
|
|
| 130 |
|
| 131 |
take a look at the docs if you want to install from source.
|
| 132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
============
|
| 134 |
Quick Start
|
| 135 |
============
|
|
@@ -613,6 +623,23 @@ can be used with all supported translators.
|
|
| 613 |
translated = GoogleTranslator(source='auto', target='de', proxies=proxies_example).translate("this package is awesome")
|
| 614 |
|
| 615 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 616 |
|
| 617 |
|
| 618 |
Usage from Terminal
|
|
|
|
| 114 |
* Automatic single language detection
|
| 115 |
* Batch language detection
|
| 116 |
* Translate directly from a text file
|
| 117 |
+
* Translate docx files (version >= 1.9.4)
|
| 118 |
+
* Translate PDF files (version >= 1.9.4)
|
| 119 |
* Get multiple translation for a word
|
| 120 |
* Automate the translation of different paragraphs in different languages
|
| 121 |
* Translate directly from terminal (version >= 1.1.0)
|
|
|
|
| 132 |
|
| 133 |
take a look at the docs if you want to install from source.
|
| 134 |
|
| 135 |
+
Also, you can install extras if you want support for specific use case. For example, translating Docx and PDF files
|
| 136 |
+
|
| 137 |
+
.. code-block:: console
|
| 138 |
+
|
| 139 |
+
$ pip install -U deep-translator[docx] # add support for docx translation
|
| 140 |
+
|
| 141 |
+
$ pip install -U deep-translator[pdf] # add support for pdf translation
|
| 142 |
+
|
| 143 |
============
|
| 144 |
Quick Start
|
| 145 |
============
|
|
|
|
| 623 |
translated = GoogleTranslator(source='auto', target='de', proxies=proxies_example).translate("this package is awesome")
|
| 624 |
|
| 625 |
|
| 626 |
+
File Translation
|
| 627 |
+
--------------------
|
| 628 |
+
|
| 629 |
+
Deep-translator (version >= 1.9.4) supports not only text file translation, but docx and PDF files too.
|
| 630 |
+
However, you need to install deep-translator using the specific extras.
|
| 631 |
+
|
| 632 |
+
For docx translation:
|
| 633 |
+
|
| 634 |
+
.. code-block:: console
|
| 635 |
+
|
| 636 |
+
pip install deep-translator[docx]
|
| 637 |
+
|
| 638 |
+
For PDF translation:
|
| 639 |
+
|
| 640 |
+
.. code-block:: console
|
| 641 |
+
|
| 642 |
+
pip install deep-translator[pdf]
|
| 643 |
|
| 644 |
|
| 645 |
Usage from Terminal
|