Skip to main content

A simple API for translating your programs

Project description

jdTranslationHelper

With jdTranslationHelper you can translate your programs. The translation files are .lang files which has ths format:

key=Hello World
test=This is a test

The files are in a folder named after the language code e.g. en_GB.lang

Here is a example how to use this API:

from jdTranslationHelper import jdTranslationHelper

translations = jdTranslationHelper()
translations.loadDirectory("/home/User/translations")
print(translatios.translate("test"))

If we place the above en_GB.lang file in /home/User/translations, it will print This is a test. You can create files for any language.

You can also call jdTranslationHelper with arguemnts:
lang=The language which should be loaded. If not specified, it will use the system language.
defaultLanguage=The language that will be usesd, if there is no file with the system language. Default is en_GB.

translate takes this argument:
default: That will be returned, if the given key doesn't exists.

You can get alls Strings with getStrings().

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

jdTranslationHelper-2.0.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

jdTranslationHelper-2.0-py3-none-any.whl (3.5 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