Giter Site home page Giter Site logo

kevin-valerio / apitranslator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thomas-soutif/apitranslator

0.0 1.0 0.0 32 KB

A library that help translating text in Python, with possibility of adding new translation module

License: Apache License 2.0

Python 100.00%

apitranslator's Introduction

APITranslator

A library that help translating text in Python, with possibility of adding new translation module.

For now, only the DeepL traductor is available.

Installation

Install the dependencies with poetry

poetry install

Go in your virtualenv

poetry shell

Generate and install the package locally

python3 -m build
python3 -m pip install dist/ApiTranslator-VERSION.tar.gz

Test the package

python3 -m pytest

Usage

For the DeepL translator module

Construct your first object

from ApiTranslator import DeepLTranslator
trans_module = DeepLTranslator(target_language_full="FRENCH",source_language=None)

To know all the language support by the library, check Language support by the library lower

Authentification

Auth directly with your key

trans_module.auth("yourkey")

Auth with a .env key store

trans_module.auth()

NOTE: When you call auth() without argument, it will search in the .env file if there is a KEY_DEEPL_API key.

Get your DeepL API Key

You will need an api key to run the project, go to the https://www.deepl.com/en/pro-api website, and create your account for free

Then, store your API KEY to the .env file as the variable KEY_DEEPL_API

Translate your first sentence

text_in_french :str = trans_module.translate("I'm an English sentence.")

NOTE: The DeepLModule will try to translate with formality if it supports for the language. To know the list of language support please see https://support.deepl.com/hc/en-us/articles/4406432463762-About-the-formal-informal-feature

Language support by the library

DeepL

['BULGARIAN', 'CZECH', 'DANISH', 'GERMAN', 'GREEK', 'ENGLISH', 'SPANISH', 'ESTONIAN', 'FINNISH', 'FRENCH', 'HUNGARIAN', 'INDONESIAN', 'ITALIAN', 'JAPANESE', 'LITHUANIAN', 'LATVIAN', 'DUTCH', 'POLISH', 'PORTUGUESE', 'ROMANIAN', 'RUSSIAN', 'SLOVAK', 'SLOVENIAN', 'TURKISH', 'SWEDISH', 'CHINESE'].

apitranslator's People

Contributors

thomas-soutif avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.