Skip to main content

A lightweight, simple to use wrapper for the Microsoft translate API.

Project description

Microsoft Translate Wrapper

A lightweight, simple to use wrapper for the microsoft translate API that simply does the API call and returns the raw, unmanipulated result.

Why Should I Use This?

It saves you time whilst adding no more code to your project than necessary

Installation

For now download off git and put into your python packages folder, it will probably be on pypi eventually

Setup

from MicroTranslator import Translator

tr = Translator(client_key="key")

Translate

tr.translate("Hello World!", "de")
# [{'detectedLanguage': {'language': 'en', 'score': 1.0}, 'translations': [{'text': 'Hallo Welt!', 'to': 'de'}]}]

Detect

tr.detect("Hallo Welt!")
#[{'language': 'de', 'score': 1.0, 'isTranslationSupported': True, 'isTransliterationSupported': False}]

Dictionary

tr.dictionary("test", "it", "en")
# text, to lang, from lang

# [{'normalizedTarget': 'fuoco', 'displayTarget': 'fuoco', 'posTag': 'OTHER', 'confidence': 0.8043, 'prefixWord': '', 'backTranslations': 
#   [{'normalizedText': 'fire', 'displayText': 'fire', 'numExamples': 1, 'frequencyCount': 33741}, 
#    {'normalizedText': 'firing', 'displayText': 'firing', 'numExamples': 0, 'frequencyCount': 559}
#   ]
# }]
# etc...

Languages

tr.languages()

# {'af': {'name': 'Afrikaans', 'nativeName': 'Afrikaans', 'dir': 'ltr'}, 
#   'am': {'name': 'Amharic', 'nativeName': 'አማርኛ', 'dir': 'ltr'}}
# etc...

See it in the wild

View my discord bot which uses this exact package for all the free translations!

Have something to contribute?

Go ahead and make a pull request! I should always be around to review them!

Issues?

Make an issue! Try to add as much detail as possible, including screenshots and tracebacks are super useful

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

MicroTranslator-1.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

MicroTranslator-1.0.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file MicroTranslator-1.0.1.tar.gz.

File metadata

  • Download URL: MicroTranslator-1.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for MicroTranslator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4f772f34e735555da6ef925bd0f6347b8ebf4bbc9fc0376e20969b7fcd6e9945
MD5 c1947113e0bbb441380628e4b3d36f16
BLAKE2b-256 7f41e39eea1b2d44356d92107aca6e47143129309980d3687643766376fdd80d

See more details on using hashes here.

File details

Details for the file MicroTranslator-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: MicroTranslator-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for MicroTranslator-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 335551748cd60d1469de8f77db565fe9182b1adadda7d937f5c45d11ce8f7db4
MD5 9f2f4bda0764cdc75a778e5828e8af9e
BLAKE2b-256 644c22ae53415f094016fd2741d4289f4457fac8efe7829ec08244b227830b28

See more details on using hashes here.

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