Skip to main content

Microsoft Translator API wrapper

Project description

Travis-ci: continuous integration status. PyPI version

Installation

Install with pip:

$ pip install mstranslator

Usage

1. Subscribe to the Microsoft Translator API

Subscribe to the Microsoft Translator dataset on Azure Marketplace. Note that subscriptions, up to 2 million characters a month, are free. Translating more than 2 million characters per month requires a payment.

2. Register an application

Register an application here. As the redirect field is not used but it’s marked as required you may enter any URI to pass validation.

That’s all. Now you have a Client ID and Client secret.

Example Usage:

>>> from mstranslator import Translator
>>> translator = Translator('<Client ID>', '<Client secret>')
>>> print(translator.translate('Привет, мир!', lang_from='ru', lang_to='en'))
Hello World!

Testing

To run tests you need to set TEST_MSTRANSLATOR_CLIENT_ID and TEST_MSTRANSLATOR_CLIENT_SECRET environment variables and install tox package. After that run shell command:

$ tox

History

0.2.5 (2013-07-23)

  • Fixed README formating

0.2.4 (2013-07-18)

  • Added translate_array and detect_langs methods (by @wjt)

0.2.3 (2013-05-08)

  • Added get_translations method

0.2.2 (2013-05-05)

  • Added break_sentences method

  • Added add_translation method

0.2.1 (2013-05-04)

  • Added get_lang_names method

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mstranslator-0.2.5.tar.gz (5.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page