Skip to main content

django-i18next

django-i18next - Additions to Django’s i18n module.

Prerequisites

  • Django 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10

  • Python >= 2.6.8, >= 2.7, >= 3.4

Roadmap

See the TODOS for the full list of planned-, pending- in-development- or to-be-implemented features.

Installation

  1. Install latest stable version from PyPI:

pip install django-i18next

Or latest stable version from GitHub:

pip install -e git+https://github.com/barseghyanartur/django-i18next@stable#egg=django-i18next

Or latest stable version from BitBucket:

pip install -e hg+https://bitbucket.org/barseghyanartur/django-i18next@stable#egg=django-i18next
  1. Add i18next to INSTALLED_APPS of the your projects’ Django settings.

INSTALLED_APPS = (
    # ...
    'i18next',

    # Other project specific apps
    'foo', # Test app
    # ...
)

Usage

Override locale

No matter what your current locale is, you can override it for a certain part of your template using the overridelocale template tag.

Load the templatetags.

{% load i18n i18next %}

The following code forces Dutch locale for whatever is put inside the overridelocale block.

{% overridelocale 'nl' %}
    <p>
        <a href="/login/">{% trans "Log in" %}</a>
    </p>
{% endoverridelocale %}

The following code forces Russian locale for whatever is put inside the overridelocale block.

{% overridelocale 'ru' %}
    <p>
        <a href="/login/">{% trans "Log in" %}</a>
    </p>
{% endoverridelocale %}

The following code forces English locale for whatever is put inside the overridelocale block.

{% overridelocale 'en' %}
    <p>
        <a href="/login/">{% trans "Log in" %}</a>
    </p>
{% endoverridelocale %}

Disable translations

No matter what your current locale is, you can disable translations for a certain part of your template using the disabletranslations template tag.

{% load i18n i18next %}

{% disabletranslations %}
    <p>
        <a href="/login/">{% trans "Log in" %}</a>
    </p>
{% enddisabletranslations %}

Demo

Live demo

See the live demo app on Heroku.

Run demo locally

In order to be able to quickly evaluate the django-i18next, a demo app (with a quick installer) has been created (works on Ubuntu/Debian, may work on other Linux systems as well, although not guaranteed). Follow the instructions below for having the demo running within a minute.

Grab the latest django_i18next_example_app_installer.sh:

wget https://raw.github.com/barseghyanartur/django-i18next/stable/examples/django_i18next_example_app_installer.sh

Assign execute rights to the installer and run the django_i18next_example_app_installer.sh:

chmod +x django_i18next_example_app_installer.sh
./django_i18next_example_app_installer.sh

Open your browser and test the app.

If quick installer doesn’t work for you, see the manual steps on running the example project.

Debugging

By default debugging is turned off. Set the I18NEXT_DEBUG to True in the settings.py of your project in order to do so.

License

GPL 2.0/LGPL 2.1

Support

For any issues contact me at the e-mail given in the Author section.

Author

Artur Barseghyan <artur.barseghyan@gmail.com>

Metadata

Release files for django-i18next 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-i18next 0.1.3
File Size Uploaded Provenance Actions
django-i18next-0.1.3.tar.gz 24.2 kB Without provenance Details for django-i18next-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-i18next 0.1.3
File Interpreter ABI Platform Actions
django_i18next-0.1.3-py2.py3-none-any.whl Python 3, Python 2 none any Details for django_i18next-0.1.3-py2.py3-none-any.whl

Total release size: 35.1 kB

Release files / django-i18next-0.1.3.tar.gz

Download URL django-i18next-0.1.3.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a4b64473cc3c65b3847eb2ac447e2d00493ec63ba9a7151b27fd8dab394af215
BLAKE2b-256 checksum
How to use checksums
980dfd29e1fd815ca9ffb487800cafa4ca94b5e03d5d1fb9704b8332261a0186
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_i18next-0.1.3-py2.py3-none-any.whl

Download URL django_i18next-0.1.3-py2.py3-none-any.whl
Size 10.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8365f2944dba167e76831da304c14127ec782eed6cc441234df3f402d4ec324c
BLAKE2b-256 checksum
How to use checksums
96271b6c216222e12d7ee1d92c11e87853131bea66394936f0a016186d5d8745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-i18next 0.1.3

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.

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