Pull strings from a variety of sources, collapse whitespace, support context (msgctxt), and merging .pot files.
Project description
Tower provides some additional functionality to Jinja and it’s i18n extension, and the Babel library. Specifics:
Pulls strings from a variety of sources: Python, JavaScript, and .lhtml files.
Collapses whitespace in all strings to prevent unwieldy msgids.
Supports Gettext context (msgctxt) in all gettext, and ngettext calls.
Supports merging PHP and Python .pot files. This is temporary. If you want to support that for an extended time look at phppo2pypo in the Translate Toolkit.
Requirements
Look at requirements.txt.
Installation
pip install -e git://github.com/clouserw/tower.git#egg=tower
A note on safe-ness
L10n strings are marked “safe” for Jinja2 automatically, so they will not be HTML-escaped:
{{ _('Hello <strong>World</strong>') }}
This works as expected. When interpolating into an L10n string, however, it will be marked as “unsafe” and escaped, unless you use jingo’s |fe() helper (which will escape the arguments but not the string they are interpolated into). Like this:
{{ _('Hello <strong>{0}</strong>')|fe(user.nickname) }}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file tower-0.3.4.tar.gz
.
File metadata
- Download URL: tower-0.3.4.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d302a6c5bc799db2813ff3adb841a45c46ef9ab368aa3d6c4e14a76096985176 |
|
MD5 | ae98c38986206a1262061154659b27e8 |
|
BLAKE2b-256 | 5a9870b24f87e4692b941efb18ff2526549fd9cdec1158947d271ff13b21a390 |