Skip to main content

Extract gettext strings from python template

Project description

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

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

pywebgettext-0.0.3.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file pywebgettext-0.0.3.tar.gz.

File metadata

File hashes

Hashes for pywebgettext-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b8dd4417ba65c33785483feb835a18d6e93e69124e40a6a8d440d8c37d67abee
MD5 e63e07de799949c35f35aeca1a276e11
BLAKE2b-256 89b7a5aa4b238aa481fd4559ab6b648d90917844869fe681b094b8fe8ef088b3

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