New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mstranslator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mstranslator

Microsoft Translator API wrapper

  • 0.3.2
  • PyPI
  • Socket score

Maintainers
1

============================================== 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 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.

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

.. code-block:: pycon

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

.. code-block:: console

$ tox

.. _Microsoft Azure: http://azure.com .. _tox: http://tox.readthedocs.org/en/latest/

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 <https://github.com/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 <https://github.com/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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc