Transifex Python Toolkit
Transifex Python Toolkit is a collection of tools that allow you to easily localize your Django and Python applications using Transifex. The toolkit features fetching translations over the air (OTA) to your apps.
This project adheres to the Contributor Covenant code of conduct. To contribute to Transifex Python Toolkit, please check out the contribution guidelines.
Upgrade to v2
If you are upgrading from the 1.x.x version, please read this migration guide, as there are breaking changes in place.
Quick starting guide
- Install toolkit in your code
$ pip install transifex-python - Add a provided TOKEN and SECRET in your config, connecting your application with a Transifex project
- Add internationalization commands in your code
<!-- Django app template example -->
{% load transifex %}
<p>{% t "Hello!" %}</p>
<p>{% t "I want to be translated." %}</p>
# Django view sample
from transifex.native.django import t
output = {
"msg1": t("Welcome aboard!"),
"msg2": t("It's great to have you here!"),
}
return JsonResponse(output)
- Push strings to your connected Transifex project
./manage.py transifex push - When translations are added in your Transifex project are automatically made available
To learn more about using Transifex Python toolkit check:
- Quickstart guide for Django web application
- Quickstart guide for Python application
- For a general overview visit Transifex Native overview
- For some common questions & answers check our Transifex Native community
Django settings reference
The Transifex Native Django sdk is controlled via a set of configuration options defined in Django settings:
-
TRANSIFEX_TOKEN: API token that connects your application to a Transifex project. Must be set for both pushing source strings and fetching translations.
-
TRANSIFEX_SECRET: Secret used together with the token for authenticated operations against CDS (e.g. pushing source content, invalidating cache).
-
TRANSIFEX_CDS_HOST: Override the default CDS host (https://cds.svc.transifex.net).
-
TRANSIFEX_FILTER_STATUS: Optional CDS filter[status] parameter used when fetching translations (e.g. "reviewed", "proofread"). If not set, CDS returns all available statuses.
-
TRANSIFEX_FILTER_TAGS: Optional CDS filter[tags] parameter used when fetching translations. Use this to limit fetched content to specific tags.
-
TRANSIFEX_MISSING_POLICY: Custom “missing translation” policy class. Defaults to the built-in SourceStringPolicy when not provided.
-
TRANSIFEX_ERROR_POLICY: Custom error handling policy class. Defaults to SourceErrorPolicy.
-
TRANSIFEX_CACHE Custom cache implementation. Defaults to an in-memory cache (MemoryCache) if not provided. Can be used to integrate with a shared cache (e.g. Redis, memcached).
-
SKIP_TRANSLATIONS_SYNC: If True, disables automatic translation sync (OTA) for this environment.
-
TRANSIFEX_SYNC_INTERVAL: Interval in seconds for the background sync daemon that fetches translations. Default: 30 * 60 (30 minutes). Set to 0 to disable periodic sync and only fetch on startup.
-
TRANSIFEX_FETCH_ALL_LANGUAGES: When True, fetch translations for all languages configured in CDS. When False (default), only fetch translations for languages listed in Django’s LANGUAGES setting.
-
TRANSIFEX_FETCH_TIMEOUT: Approximate maximum time in seconds for one fetch of languages and translations from CDS, including retries. It can be exceeded, e.g. by DNS resolution, a host with several IP addresses, or a response that keeps sending data slowly (the read timeout applies between received bytes, not to the whole response). Languages are fetched in LANGUAGES order; those not reached in time are skipped until the next sync, or for the life of the process if TRANSIFEX_SYNC_INTERVAL is 0. 0 (default) = no global timeout: if CDS keeps answering 202, the fetch, and so startup, waits until it stops. Set it when translations are fetched at startup, e.g. under gunicorn.
-
TRANSIFEX_REQUEST_TIMEOUT: Timeout in seconds for each request made when fetching from CDS, either a number greater than 0 or a
(connect, read)tuple as accepted byrequests. Invalid values are logged and the default is used. Defaults to(10, 60).
License
Licensed under Apache License 2.0, see LICENSE file.
Metadata
Release files for transifex-python 3.8.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 |
|---|---|---|---|---|
| transifex_python-3.8.0.tar.gz | 143.8 kB | Without provenance | Details for transifex_python-3.8.0.tar.gz |
Release files / transifex_python-3.8.0.tar.gz
| Download URL | transifex_python-3.8.0.tar.gz |
|---|---|
| Size | 143.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2afd1a339c2d2ddb19d024dd722256a221f58d71f3c5b9b252681e2f1783e19a
|
|
BLAKE2b-256 checksum How to use checksums |
0759d1f9836fcddd0b4582e3b3a5af53d8872481efa75edbabe515d5db6ff45c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for transifex-python 3.8.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.