https://github.com/ayushgoel/mstranslator
Python wrapper for Microsoft Translate
https://github.com/ayushgoel/mstranslator
mstranslator python python-wrapper translation
Last synced: 7 months ago
JSON representation
Python wrapper for Microsoft Translate
- Host: GitHub
- URL: https://github.com/ayushgoel/mstranslator
- Owner: ayushgoel
- License: mit
- Created: 2016-03-05T07:28:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-18T19:20:31.000Z (over 9 years ago)
- Last Synced: 2025-03-15T18:22:00.415Z (8 months ago)
- Topics: mstranslator, python, python-wrapper, translation
- Language: Python
- Size: 16.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mstranslator
-
Python wrapper for Microsoft Translate services.
The API lets you:
1. Detect language for given text.
2. Translate given text to another language supported by Microsft Translate.
3. `access_token` is managed by the package itself.
Usage
-
```python
$ import mstranslator.translator as translator
# Create Config instance.
$ config = translator.Config("Client ID", "Client Secret")
# Create translator instance using the Config instance. This instance now uses
# the same config for all translation related tasks. You can create more than
# one instances if required.
$ translator = translator.Translator(config)
# Detect language of the given text. The detected language's code and an
# authorization header is returned.
$ translator.detect_language("Hello")
('en',
u'Authorization Header')
# Translate a given text to another language (Hindi used in example here).
# Authorization header generated above in detect language call can be reused.
# If not given in argument, a new one is generated.
$ print translator.translate("hello", 'en', 'hi', u'Authorization Header')
नमस्कार
```
Steps to upload to PyPI
-
```bash
$ git pull
$ vi setup.py # Edit version here.
$ git commit -m "Update version to #NEW_VERSION"
$ python setup.py check # Should return no errors or warnings.
$ git tag # NEW_VERSION
$ git push --tags
$ git push
$ python setup.py sdist upload -r pypi # Upload to PyPI
```
Author
-
Ayush Goel, ayushgoel111@gmail.com
License
-
mstranslator-2016 is available under the MIT license. See the LICENSE file for more info.