Skip to main content

Microsoft Translator API wrapper

Project description

==============================================
mstranslator: Microsoft Translator API wrapper
==============================================

.. image:: https://travis-ci.org/wronglink/mstranslator.png?branch=master
:target: https://travis-ci.org/wronglink/mstranslator
:alt: Travis-ci: continuous integration status.

.. image:: https://badge.fury.io/py/mstranslator.png
:target: http://badge.fury.io/py/mstranslator
:alt: PyPI version

Installation
============

Install with pip:

.. code-block:: console

$ 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:

.. code-block:: pycon

>>> 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:

.. code-block:: console

$ tox

.. __: https://datamarket.azure.com/developer/applications/
.. _Microsoft Translator dataset: https://datamarket.azure.com/dataset/bing/microsofttranslator
.. _tox: http://tox.readthedocs.org/en/latest/


History
-------
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.4.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