Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.


pip install pywebgettext


  1. Generate POT translation file:
$ pywebgettext --output=locale/messages.pot --sort-by-file template1.html
  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/

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pywebgettext, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size pywebgettext-0.0.3.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page