Skip to main content

A command line application that automatically translates the input sentence to multiple languages adds the translations to respective translation json files

Project description

multilingual

Alt Text

This is a command line application that automatically translates the input sentence to multiple languages and adds the translations to respective translation json files

You must run this script in the root folder where you keep your translation files. For now, this script assumes that you name your translations with the following patterns:

├───public  // translations root folder
│   ├───de.json  // {country-iso}.json
|   ├───main_de.json  // *_{country_iso}.json
│   └───main-de.json  // *-{country_iso}.json

Installation

  1. Make sure you have at least Python v3.10.2 installed.

  2. Install the package:

$ pip install multilingual
  1. Go to the project folder where you keep your translation json files and run multilingual command with the sentence you want to translate:
$ cd {YOUR_PROJECT}/{TRANSLATIONS_DIR}` 

$ multilingual "Sentence to be translated"

# SENTENCE_TO_BE_TRANSLATED :  Sentence to be translated ---> en-gb.json
# SENTENCE_TO_BE_TRANSLATED :  Frase a traducir ---> es.json
# SENTENCE_TO_BE_TRANSLATED :  Phrase à traduire ---> fr.json
# SENTENCE_TO_BE_TRANSLATED :  번역 될 문장 ---> ko.json
# SENTENCE_TO_BE_TRANSLATED :  Satz, um übersetzt zu werden ---> de.json
# SENTENCE_TO_BE_TRANSLATED :  Sentence to be translated ---> en.json
# SENTENCE_TO_BE_TRANSLATED :  要翻译的句子 ---> zh.json
  1. You can optionally specify your own key for your translation:
$ multilingual "Sentence to be translated" --key=TRANSLATION

# TRANSLATION:  Sentence to be translated ---> main-en-gb.json
# TRANSLATION:  Frase a traducir ---> main-es.json
# TRANSLATION:  Phrase à traduire ---> main-fr.json
# TRANSLATION:  번역 될 문장 ---> main-ko.json
# TRANSLATION:  Satz, um übersetzt zu werden ---> main-de.json
# TRANSLATION:  Sentence to be translated ---> main-en.json
# TRANSLATION:  要翻译的句子 ---> main-zh.json

Requirements

  • Python 3.10.2

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

multilingual-0.1.1.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

multilingual-0.1.1-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

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