Skip to main content

Un module pour traduire, détecter et afficher les langues supportées par winiTranslate.

Project description

winiTranslate

winiTranslate is a simple Python module that allows you to:

  • Translate text
  • Detect the language of a text
  • List all available languages from Google Translate

Installation

You can install winiTranslate using pip:

pip install winiTranslate

If you prefer to install it locally after cloning the repository, use:

pip install -r requirements.txt

Usage

You can use winiTranslate to translate text, detect the language of a text, and list the supported languages by Google Translate.

Importing the Module

To use the module, simply import the necessary functions like this:

from winiTranslate import translate, detect, list

Example 1: Translate Text

The translate function allows you to translate text from one language to another.
You can specify the source language (or use 'auto' for automatic detection) and the target language.

from winiTranslate import translate

# Translate text from French to English
text = "Bonjour tout le monde"
translated_text = translate(text, "en")
print(translated_text)  # Output: Hello everyone

Example 2: Detect the Language of a Text

The detect function automatically detects the language of the given text.

from winiTranslate import detect

# Detect the language of a text
text = "Bonjour tout le monde"
language_code = detect(text)
print(language_code)  # Output: 'fr' (for French)

Example 3: List All Available Languages

The list function returns a dictionary of all languages supported by Google Translate, along with their corresponding language codes.

from winiTranslate import list

# List all available languages
languages = list()
for code, language in languages.items():
    print(f"{code}: {language}")

Functions Available

  • translate(text, target_language, source_language='auto')
  • detect(text)
  • list()

Example of Language Codes

Here are some examples of supported language codes:

Code Language
en English
fr French
es Spanish
de German
zh-CN Chinese (Simplified)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

winitranslate-0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

winiTranslate-0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file winitranslate-0.1.tar.gz.

File metadata

  • Download URL: winitranslate-0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for winitranslate-0.1.tar.gz
Algorithm Hash digest
SHA256 8813297eea1e7ccc06cd78ee9097ac4003d40519e79681c51ef66a05f6efc103
MD5 2d1e7f90b37e41196d972a95dcc7d10b
BLAKE2b-256 2dfc057696510ed379f0328e0cf8cd383c09d73c67c0186e3cd7d4ea75aaf684

See more details on using hashes here.

File details

Details for the file winiTranslate-0.1-py3-none-any.whl.

File metadata

  • Download URL: winiTranslate-0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for winiTranslate-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3886f3ff16ffe093d1cd86f83a9f52394a475b325956950621590948052a731c
MD5 122d103347ea3780571dc31e54999938
BLAKE2b-256 b87c13d9242857e5a18f948268a9525f8afc7db50b5c0fb2764eeaf519967233

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page