dialecto-django
Dialecto's client for Django projects. It has no runtime dependencies and the scan never imports your project.
DIALECTO_SCAN_TOKEN=dlk_… DIALECTO_PROJECT=12 dialecto-django scan --usages
| Command | Does |
|---|---|
scan |
Sends the committed .po files, and with --usages every place the code and templates read a msgid, to Dialecto. |
usages |
Prints what the usage scan found, in the view Dialecto gets (--summary, --out FILE). Sends nothing. |
check |
Re-scans and fails when code reads a msgid that no catalog holds. Sends nothing. |
doctor |
Checks Python, git, the catalogs, the token and the server. |
Edit text in place (development only)
Add the middleware under if DEBUG:, run runserver, and open your own pages in Dialecto's editor.
# settings.py
if DEBUG:
MIDDLEWARE.insert(0, "dialecto_django.middleware.InContextMiddleware") # first, or just inside GZipMiddleware
Install it as a development dependency (pip install dialecto-django in your dev requirements only). With
DEBUG = False, or DIALECTO_IN_CONTEXT=off (an environment variable or a Django setting), Django drops the middleware
at load: nothing is patched, no /__dialecto route answers and no marker reaches a page.
- Pages are marked only while Dialecto's editor is open (it heartbeats every 30 s; the flag lapses after 90 s), for a
top-level
GETof a page on a loopback address. POSTs, JSON, XHR and frames are never marked, and a marked request that returns something other than HTML has the markers stripped. - Only strings from
.pofiles inside your repository are marked (LOCALE_PATHSand your apps'locale/folders). Django's and packages' strings,djangojs, and a missingpgettexttranslation are not. - Drafts preview in place for plain strings,
%(name)sstrings (%%is a literal%) andngettextplurals in any locale; the overlay reads the values off the page and the plural form from the marker. Brace ({name}) and positional (%s) strings, and a page value it cannot read back unambiguously, show "Reload to preview" instead, which renders the draft on the server. INSTALLED_APPS += ["dialecto_django"]is optional; it starts the same add-on inAppConfig.ready().- Settings:
DIALECTO_URL,DIALECTO_PROJECT,DIALECTO_PATHS(URL prefixes the add-on is limited to) andDIALECTO_ROOT(the repository folder; default the git top level). ADIALECTO = {...}dict in settings sets the same options by lower-case name. - With django-csp the add-on adds the Dialecto origin to
CONTENT_SECURITY_POLICYdirectives when it starts. State (drafts, the marking flag) is per process: run one worker. Avoid{% cache %}andcache_pagewhile editing; useDummyCache. dialecto-django doctorwithDJANGO_SETTINGS_MODULEset checks the middleware position, django-csp,i18n_patterns, the cache backend,--forwarded-allow-ips='*'and worker count.
Settings
Option over environment over default.
| Variable | Default |
|---|---|
DIALECTO_URL |
https://app.dialecto.eu |
DIALECTO_PROJECT |
none (the project's number) |
DIALECTO_SCAN_TOKEN |
none (environment only) |
DIALECTO_CATALOG_PATHS |
locale/**/*.po,*/locale/**/*.po |
DIALECTO_USAGES=on |
off |
DIALECTO_REQUIRE_USAGES |
off |
DIALECTO_USAGES_EXCLUDE |
none |
DIALECTO_I18N_FUNCTIONS |
none (your wrappers that take a msgid first) |
DIALECTO_TEMPLATE_EXTENSIONS |
none (added to .html, .txt, .xml) |
DIALECTO_DEFAULT_BRANCH |
the remote's origin/HEAD |
CI
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: pip install dialecto-django
- run: dialecto-django scan --usages
env:
DIALECTO_SCAN_TOKEN: ${{ secrets.DIALECTO_SCAN_TOKEN }}
DIALECTO_PROJECT: "12"
Dialecto reads committed .po files only. .mo files are build output: they are never read, sent or written, so run
compilemessages in your own build after a merged Dialecto pull request.
Exit codes
| Exit | When |
|---|---|
| 0 | Sent, already scanned, or the branch isn't scanned |
| 1 | check found problems |
| 2 | The command can't start: missing token or project, bad URL, not a git repository, a limit |
| 3 | Dialecto refused and a retry can't help (401, 403, 413, 422) |
| 4 | Still failing after three tries (429, 5xx, timeout, connection refused) |
Metadata
Release files for dialecto-django 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dialecto_django-0.1.0.tar.gz | 98.3 kB | Without provenance | Details for dialecto_django-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dialecto_django-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dialecto_django-0.1.0-py3-none-any.whl |
Total release size: 157.5 kB
Release files / dialecto_django-0.1.0.tar.gz
| Download URL | dialecto_django-0.1.0.tar.gz |
|---|---|
| Size | 98.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5297d0f00f917bb8322353622a2cbe88334859d2aeb7314d9912ec72ea6b596e
|
|
BLAKE2b-256 checksum How to use checksums |
17ba04457ea9d587517100bb05bb96f88285dd12f9e9c536e24a2746bf11307c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dialecto_django-0.1.0-py3-none-any.whl
| Download URL | dialecto_django-0.1.0-py3-none-any.whl |
|---|---|
| Size | 59.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2cee6665f3a0c477eaae3e2fc82689921df93f7e7c6ab6fd8a329cd1b4180daf
|
|
BLAKE2b-256 checksum How to use checksums |
739113afe86d366c199e50dfeef6a8cbbf527845fc21afa20485f85e26df373d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for dialecto-django 0.1.0
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.