Skip to main content

django-makemessages-rs

PyPI License: MIT

A fast Rust alternative to Django's makemessages command. Produces byte-identical .po file output compared to django-extended-makemessages.

Tested against a ~2000 file Django project with ~3000 translatable strings across 5 locales:

Tool Time
django-extended-makemessages ~21s
django-makemessages-rs ~0.3s

Install

pip install django-makemessages-rs

Platform wheels are available for macOS (arm64, x86_64) and Linux (x86_64, aarch64).

Usage

django-makemessages-rs \
  -l en -l zh_Hant -l zh_Hans -l ko -l ja \
  --ignore .venv --ignore node_modules \
  --no-location --no-flags --sort-output \
  --no-fuzzy-matching --keep-header \
  --locale-dir locale

CI check mode

Use --check to verify translation files are in sync with source code. Exits with code 1 if any .po file would change:

django-makemessages-rs \
  -l en -l zh_Hant \
  --ignore .venv --ignore node_modules \
  --no-location --no-flags --sort-output \
  --no-fuzzy-matching --keep-header \
  --locale-dir locale \
  --check

Options

-l, --locale <LOCALES>       Locales to generate (required, repeatable)
-i, --ignore <PATTERNS>      Patterns to ignore (directories/files)
-d, --domain <DOMAIN>        Domain name [default: django]
-e, --extension <EXTS>       File extensions to examine [default: html txt py]
    --root <PATH>            Root directory to scan [default: .]
    --locale-dir <PATH>      Locale directory [default: locale]
    --no-location            Don't write #: filename:line lines (shorthand for --add-location never)
    --add-location <MODE>    Controls #: location comments: full (default), file, or never
    --no-flags               Don't write #, flags lines
    --sort-output            Generate sorted output
    --no-fuzzy-matching      Do not use fuzzy matching
    --keep-header            Keep the existing .po file header
    --no-obsolete            Remove obsolete message strings
    --no-wrap                Don't break long message lines
    --check                  Exit with error if .po files would change (dry-run)
    --timing                 Show timing information

How it works

  1. Walks the project tree using ignore (same engine as ripgrep)
  2. Extracts translatable strings from .py and .html/.txt templates in parallel using rayon
  3. Merges extracted strings with existing .po files, preserving translations
  4. Writes updated .po files

The extractor handles:

  • Python gettext(), ngettext(), pgettext(), npgettext() and the _() alias
  • Django template tags: {% trans %}, {% translate %}, {% blocktrans %}, {% blocktranslate %}
  • {% blocktrans trimmed %} whitespace collapsing
  • {% blocktrans %}...{% plural %}...{% endblocktrans %} plural forms
  • Python implicit string concatenation (_("foo" "bar"))
  • Template variable substitution ({{ var }} to %(var)s)
  • Literal % escaping to %%

No Django settings or DJANGO_SETTINGS_MODULE required — runs as a standalone CLI.

Pre-commit / Git hooks integration

Add to your pyproject.toml dev dependencies:

"django-makemessages-rs"

Then in your pre-commit script:

uv run django-makemessages-rs \
  -l en -l zh_Hant \
  --ignore .venv --ignore node_modules \
  --no-location --no-flags --sort-output \
  --no-fuzzy-matching --keep-header \
  --locale-dir locale

License

MIT

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

django_makemessages_rs-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

django_makemessages_rs-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

django_makemessages_rs-0.4.0-py3-none-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

django_makemessages_rs-0.4.0-py3-none-macosx_10_12_x86_64.whl (1.2 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file django_makemessages_rs-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for django_makemessages_rs-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8ebdf437554f58b3ad7ad73cec5ebd8a05ab206c972e162d4f3f6017d035fc55
MD5 8c539a47d6f6f731573b353d6081f333
BLAKE2b-256 fe4267d0d8ec1d297c022ff0e39d55dc19c56db0a10249c564d7393103f17892

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_makemessages_rs-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on zxzinn/django-makemessages-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_makemessages_rs-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for django_makemessages_rs-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a1848e6136f1ec91b33bc4b47de50f7e430f75933fffce84578ebb66d0472f5d
MD5 dd8fc12cfe726739edcb02fdb094d181
BLAKE2b-256 aaae1bc7ac9af5d244b6d0ea025828d951ba8d881700c7e0d7a534f711d49f01

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_makemessages_rs-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on zxzinn/django-makemessages-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_makemessages_rs-0.4.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for django_makemessages_rs-0.4.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa54e3fdbd236d48c1c5670dc97f7cbbdb2508f1e891f2e7f4585821b2ecb23b
MD5 907abc9d075271b4b2d626633e4eb4d9
BLAKE2b-256 01287c509f42c3db45c66d983a8dbf774af6edcfcb449c57aba021331b9a85a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_makemessages_rs-0.4.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on zxzinn/django-makemessages-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_makemessages_rs-0.4.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for django_makemessages_rs-0.4.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1fdec60f79ff75deeb2960d820af0e0e0ad7299950609e8d9ec0bb398d732ca8
MD5 4ff9dc80264bee0d80aea3cffb7f3df4
BLAKE2b-256 8f201cddc63d1b6213c20a27d4c34e51ccc5be4163f7fba05539b829b97e8517

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_makemessages_rs-0.4.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on zxzinn/django-makemessages-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.8.0

4 files

0.7.0

4 files

0.6.0

4 files

0.5.0

4 files

This release

0.4.0 This release

4 files

0.3.2

4 files

0.3.1

4 files

0.3.0

4 files

0.2.0

4 files

0.1.4

4 files

0.1.2

4 files

0.1.1

3 files

0.1.0

3 files

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