It is an improvement to the implementation of django gettext for javascrtipt.
Features:
Now parse javascript teplates for translatable strings (tested with underscore.template)
New I18n view more extensible (build on top of CBV) that exposes the djangojs gettext domain and djsgettext domain generated for translation scrings from js templates. Aditionaly the performance is improved with caching of this view (does not supports by django view as default behavior).
How it works?
Django makemesages command generates a djangojs domain po file from *.js files, django-jsgettext generates a djgettext domain po file from .html files (javascript templates) and the new view exposes the two gettext domains to the javascript.
Currently, only is tested with underscore templates. Example:
<div><%= gettext('sample message') %></div>
<div><%= ngettext('1 message', 'some messages', num) %></div>
<div><%= interpolate(gettext('sample %s'), [1]) %></div>
How use it?
Urls files:
from djsgettext.views import I18n
urlpatterns = patterns('',
url(r'^js-gettext/$', I18n.as_view()),
)
Collect messages from templates:
python manage.py jsgettext_makemessages
Release files for django-jsgettext 0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-jsgettext-0.5.tar.gz | 5.4 kB | Details |
Release files / django-jsgettext-0.5.tar.gz
| Download URL | django-jsgettext-0.5.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c834735a722d310c90320751d1a5f1cb8ed938f6e52c422a0522b07da985433e
|
|
BLAKE2b-256 checksum How to use checksums |
1a9e08614cfd3e1c05444b7ae7901af79cd55c51db84855ace09172ce4264d07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |