=
commited on
Commit
·
f123cfb
1
Parent(s):
5851a3c
added terminal support
Browse files- README.rst +33 -4
- deep_translator/__init__.py +1 -1
- docs/usage.rst +28 -0
- setup.cfg +1 -1
- setup.py +1 -1
README.rst
CHANGED
@@ -79,6 +79,7 @@ Features
|
|
79 |
* Translate directly from a text file
|
80 |
* Get multiple translation for a word
|
81 |
* Automate the translation of different paragraphs in different languages
|
|
|
82 |
|
83 |
Installation
|
84 |
=============
|
@@ -142,14 +143,42 @@ The mymemory translator is also supported for version >= 1.0.2:
|
|
142 |
word = 'good'
|
143 |
translated_word = MyMemoryTranslator(source='english', target='french').translate(word)
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
========
|
146 |
Links
|
147 |
========
|
148 |
Check this article on medium to know why you should use the deep-translator package and how to translate text using python.
|
149 |
https://medium.com/@nidhalbacc/how-to-translate-text-with-python-9d203139dcf5
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
154 |
Take a look in the examples folder for more :)
|
155 |
-
Feel free to
|
|
|
79 |
* Translate directly from a text file
|
80 |
* Get multiple translation for a word
|
81 |
* Automate the translation of different paragraphs in different languages
|
82 |
+
* Translate directly from terminal (version >= 1.1.0)
|
83 |
|
84 |
Installation
|
85 |
=============
|
|
|
143 |
word = 'good'
|
144 |
translated_word = MyMemoryTranslator(source='english', target='french').translate(word)
|
145 |
|
146 |
+
Usage from Terminal
|
147 |
+
====================
|
148 |
+
|
149 |
+
For a quick access, you can use the deep_translator from terminal. For this to work, you need to provide
|
150 |
+
the right arguments, which are the translator you want to use, source language, target language and the text
|
151 |
+
you want to translate.
|
152 |
+
|
153 |
+
For example, provide "google" as an argument to use the google translator. Alternatively you can use
|
154 |
+
the other supported translators. Just read the documentation to have an overview about the supported
|
155 |
+
translators in this library.
|
156 |
+
|
157 |
+
.. code-block:: console
|
158 |
+
|
159 |
+
$ deep_translator --translator "google" --source "english" --target "german" --text "happy coding"
|
160 |
+
|
161 |
+
Or you can go for the short version:
|
162 |
+
|
163 |
+
.. code-block:: console
|
164 |
+
|
165 |
+
$ deep_translator -trans "google" -src "english" -tg "german" -txt "happy coding"
|
166 |
+
|
167 |
+
If you want, you can also pass the source and target language by their abbreviation
|
168 |
+
|
169 |
+
.. code-block:: console
|
170 |
+
|
171 |
+
$ deep_translator -trans "google" -src "en" -tg "de" -txt "happy coding"
|
172 |
+
|
173 |
========
|
174 |
Links
|
175 |
========
|
176 |
Check this article on medium to know why you should use the deep-translator package and how to translate text using python.
|
177 |
https://medium.com/@nidhalbacc/how-to-translate-text-with-python-9d203139dcf5
|
178 |
|
179 |
+
==========
|
180 |
+
Next Step
|
181 |
+
==========
|
182 |
+
|
183 |
Take a look in the examples folder for more :)
|
184 |
+
Contributions are always welcome. Feel free to make a pull request and give me a feedback if you found the package useful/helpful or you are using it :)
|
deep_translator/__init__.py
CHANGED
@@ -8,7 +8,7 @@ from .mymemory import MyMemoryTranslator
|
|
8 |
|
9 |
__author__ = """Nidhal Baccouri"""
|
10 |
__email__ = '[email protected]'
|
11 |
-
__version__ = '1.0
|
12 |
|
13 |
__all__ = [GoogleTranslator,
|
14 |
PonsTranslator,
|
|
|
8 |
|
9 |
__author__ = """Nidhal Baccouri"""
|
10 |
__email__ = '[email protected]'
|
11 |
+
__version__ = '1.1.0'
|
12 |
|
13 |
__all__ = [GoogleTranslator,
|
14 |
PonsTranslator,
|
docs/usage.rst
CHANGED
@@ -50,3 +50,31 @@ The mymemory translator is also supported for version >= 1.0.2:
|
|
50 |
|
51 |
word = 'good'
|
52 |
translated_word = MyMemoryTranslator(source='english', target='french').translate(word)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
word = 'good'
|
52 |
translated_word = MyMemoryTranslator(source='english', target='french').translate(word)
|
53 |
+
|
54 |
+
|
55 |
+
Usage from Terminal
|
56 |
+
====================
|
57 |
+
|
58 |
+
For a quick access, you can use the deep_translator from terminal. For this to work, you need to provide
|
59 |
+
the right arguments, which are the translator you want to use, source language, target language and the text
|
60 |
+
you want to translate.
|
61 |
+
|
62 |
+
For example, provide "google" as an argument to use the google translator. Alternatively you can use
|
63 |
+
the other supported translators. Just read the documentation to have an overview about the supported
|
64 |
+
translators in this library.
|
65 |
+
|
66 |
+
.. code-block:: console
|
67 |
+
|
68 |
+
$ deep_translator --translator "google" --source "english" --target "german" --text "happy coding"
|
69 |
+
|
70 |
+
Or you can go for the short version:
|
71 |
+
|
72 |
+
.. code-block:: console
|
73 |
+
|
74 |
+
$ deep_translator -trans "google" -src "english" -tg "german" -txt "happy coding"
|
75 |
+
|
76 |
+
If you want, you can also pass the source and target language by their abbreviation
|
77 |
+
|
78 |
+
.. code-block:: console
|
79 |
+
|
80 |
+
$ deep_translator -trans "google" -src "en" -tg "de" -txt "happy coding"
|
setup.cfg
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
[bumpversion]
|
2 |
-
current_version = 1.0
|
3 |
commit = True
|
4 |
tag = True
|
5 |
|
|
|
1 |
[bumpversion]
|
2 |
+
current_version = 1.1.0
|
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.0
|
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.0',
|
55 |
zip_safe=False,
|
56 |
)
|