Skip to main content

pywebgettext - Extract gettext strings from python template

You can use pywebgettext instead of xgettext in order to generate POT translation file from HTML template. pywebgettext can extract the gettext message inside HTML tag attributes or script tag.

Installation

pip install pywebgettext

Documentation

  1. Generate POT translation file:

$ pywebgettext --output=locale/messages.pot --sort-by-file template1.html file2.py
  1. Merge against existing PO file or initialize a PO file:

$ msgmerge --sort-by-file --output-file=locale/fr_FR/LC_MESSAGES/messages.po locale/fr_FR/LC_MESSAGES/messages.po locale/messages.pot

Initialize PO file, if it doesn’t exist yet:

$ msginit --input=messages --output-file=locale/fr_FR/LC_MESSAGES/messages.po --no-wrap --locale=fr_FR
  1. Fill empty strings like msgstr “” in messages.po.

  2. Compile:

$ msgfmt locale/fr_FR/LC_MESSAGES/messages.po -o locale/fr_FR/LC_MESSAGES/messages.mo

Metadata

Release files for pywebgettext 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywebgettext 0.0.3
File Size Uploaded Provenance Actions
pywebgettext-0.0.3.tar.gz 4.9 kB Without provenance Details for pywebgettext-0.0.3.tar.gz

Release files / pywebgettext-0.0.3.tar.gz

Download URL pywebgettext-0.0.3.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b8dd4417ba65c33785483feb835a18d6e93e69124e40a6a8d440d8c37d67abee
BLAKE2b-256 checksum
How to use checksums
89b7a5aa4b238aa481fd4559ab6b648d90917844869fe681b094b8fe8ef088b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pywebgettext 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page