Skip to main content

Translate your program to different languages.

Project description

langtranslator

This module allows you to translate your program to different languages. This is done by making a json with all the translations. For further information read the usage chapter.

Installing

.. code-block:: bash

pip install langtranslator

Usage

JSON File: .. code-block:: bash

{
    "info": {"languages": ["en", "ger", "fr"]},
    "translations": {
        "string1": {"en": "This is a string.", "ger": "Das ist ein String.", "fr": "I dont know frech."},
        "string2": {"en": "test", "ger": "abc", "fr": "bonjour"}
    }
}

In info you specify the languages that are translated. In translations you specify the different translated strings.

Python: .. code-block:: bash

# How to initialize the module:
from langtranslator import langtranslator
translator = langtranslator("filename.json", "language")

# How to get strings in the specified language:
translator.get("stringKey")

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

langtranslator-1.0.2.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file langtranslator-1.0.2.tar.gz.

File metadata

  • Download URL: langtranslator-1.0.2.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for langtranslator-1.0.2.tar.gz
Algorithm Hash digest
SHA256 0da9a0423cff3da3c7d6c024f7cd2ff3977c10e7a1fdaf38530775dbf1b9dec5
MD5 bf6e459a07c03afee2f2938cbbed841d
BLAKE2b-256 1f46e47bf106922a6e123f0431cbd1698540e63fe00e3f6ff19ca9a60ddc2a61

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