telegramlib.translator

Translation and Language Detection Module

This module provides functionalities for translating text between different languages and detecting the language of a given text using the googletrans library.

Usage Example

  1. Command-Line Usage:

    `console python translator.py --english --italian Hello, World! ` The above command converts “Hello, World!” from english to Italian. `console python translator.py --english --italian Hello, World! ` The above command converts “Hello, World!” in Italian detecting the quote is in english. `console python translator.py --detect Hello, World! ` The above command detect “Hello, World!” language.

Functions

is_a_language(lan)

Checks if the given language code or name is a valid language supported by Google Translate.

language_of(text)

Detects the language of the given text.

main()

Main function that handles command-line arguments for translation and language detection.

translate(text[, src, dest])

Translates the given text from the source language to the destination language.