Skip to main content

mstranslator: Microsoft Translator API wrapper

Travis-ci: continuous integration status. PyPI version

Installation

Install with pip:

$ pip install mstranslator

Usage

1. Subscribe to the Translator API

To access Translator API you need a Microsoft Azure account. Note that subscriptions, up to 2 million characters a month, are free. Translating more than 2 million characters per month requires a payment.

2. Add Translator subscription to your Azure account

  1. Select the + New -> Intelligence + analytics -> Cognitive Services APIs.

  2. Select the API Type option.

  3. Select either Text Translation or Speech Translation.Select the pricing tier that fits your needs.

  4. Fill out the rest of the form, and press the Create button. You are now subscribed to Microsoft Translator.

  5. Now retrieve your subscription key for authentication. You can find it in All Resources -> Keys option.

That’s all. Now you have a Subscription Key and can use Microsoft Translator API.

Example Usage:

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

Testing

To run tests you need to set TEST_MSTRANSLATOR_SUBSCRIPTION_KEY environment variable and install tox package. After that run shell command:

$ tox

History

0.3.2 (2016-12-08)

0.2.6 (2016-10-02)

  • Translator API errors are now wrapped with python exceptions

  • Add translate_array2 method (by @kanghj)

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

Metadata

Release files for mstranslator 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mstranslator 0.3.2
File Size Uploaded
mstranslator-0.3.2.tar.gz 5.3 kB Details

Release files / mstranslator-0.3.2.tar.gz

Download URL mstranslator-0.3.2.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
af5150d1645b09fb234b296acb94720a2ce79c7709cf8ac6e111669215f1106b
BLAKE2b-256 checksum
How to use checksums
2fd6a075a909529b32b730553dd423d9e138f672ec5909d741163bbaa92474fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.2 This release

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page