Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/runekaagaard/hypergen-translation-plugin
A plugin for Django Hypergen which parses the AST of template python files and collects translatable strings for translation in the admin.
https://github.com/runekaagaard/hypergen-translation-plugin
django hypergen i18n liveview plugin translation
Last synced: 9 days ago
JSON representation
A plugin for Django Hypergen which parses the AST of template python files and collects translatable strings for translation in the admin.
- Host: GitHub
- URL: https://github.com/runekaagaard/hypergen-translation-plugin
- Owner: runekaagaard
- License: mpl-2.0
- Created: 2023-12-05T08:14:45.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-17T08:01:21.000Z (10 months ago)
- Last Synced: 2024-09-19T05:49:39.121Z (about 2 months ago)
- Topics: django, hypergen, i18n, liveview, plugin, translation
- Language: Python
- Homepage: https://hypergen.it
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
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"Collection collections and store it in the database::
python manage.py hypergen_translation_collect
Then edit in the admin.
Add plugin to liveviews and actions::
from hypergen_translation.plugins import TranslationPlugin
@liveview(..., user_plugins=[TranslationPlugin()])
def my_view(request):
p("translate this!")