Skip to main content

Translation plugin for Django Hypergen

Project description

Hypergen Translation Plugin

Translation plugin for Django Hypergen. Processes the AST of Hypergen template python files and inserts them into the database for translation.

Provides the TranslationPlugin that makes Hypergen liveviews and actions translatable based on the current django translation language.

Usage

Installation:

pip install hypergen-translation-plugin

Change settings.py:

# Add to installed apps:
INSTALLED_APPS = [
    ...
    'hypergen_translation'
]

# Select which importable modules to look for translatable strings in.
HYPERGEN_TRANSLATION_MODULES = ["hypergen_first_app.views"]
# The base dir of the git/whatever project.
HYPERGEN_TRANSLATION_PROJECT_DIR = BASE_DIR.parent
# Optionally display link directly to file and linenumber for each translation occurence.
HYPERGEN_TRANSLATION_GITHUB = "https://github.com/runekaagaard/hypergen-translation-plugin"
# Optionally link to another branch than main.´ on github.
HYPERGEN_TRANSLATION_BRANCH = "dev"

Add plugin to liveviews and actions:

from hypergen_translation.plugins import TranslationPlugin

@liveview(..., user_plugins=[TranslationPlugin()])
def my_view(request):
    p("translate this!")

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

hypergen-translation-plugin-0.1.2.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file hypergen-translation-plugin-0.1.2.tar.gz.

File metadata

  • Download URL: hypergen-translation-plugin-0.1.2.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.1.0 tqdm/4.66.1 importlib-metadata/7.0.0 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.18

File hashes

Hashes for hypergen-translation-plugin-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d2934a18663c40e071db8a668b2b093216c4dffece162ee4ec67d8a8ae5c889c
MD5 8850ffd8f69b8ba90da1daae0b2adf16
BLAKE2b-256 8770aa0076d2890a820705e50d98bd9e4b63cec1003ccf6ea59f9ce52af47e40

See more details on using hashes here.

File details

Details for the file hypergen_translation_plugin-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: hypergen_translation_plugin-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.1.0 tqdm/4.66.1 importlib-metadata/7.0.0 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.18

File hashes

Hashes for hypergen_translation_plugin-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0e98d09c6cd94fb4d97bc8f807a4d6cc5150164ce42578003171f816d57a0443
MD5 96374d7bdb918cbc176e81974f464e51
BLAKE2b-256 3d8e48d978b09f4bbc78cba35870943964be1806c33093b03d6ba6f6c46854e3

See more details on using hashes here.

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