Skip to main content

Django Languages Plus

https://badge.fury.io/py/django-languages-plus.svg https://github.com/cordery/django-languages-plus/actions/workflows/tox.yml/badge.svg

django-languages-plus provides models and fixtures for working with both common languages and ‘culture codes’ or locale codes, like pt-BR.

Note that this is only a small (but popular) subset of all living languages, and is not even a comprehensive set of the ISO 639 languages. It does however include the endonym/autonym/exonym.

The Language model contains all ISO 639-1 languages and related information from http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

The model provides the following fields (original wikipedia.org column name in parentheses).

  • name_en (ISO Language Name)

  • name_native (Native Name)

  • iso_639_1 (639-1)

  • iso_639_2T = (639-2/T)

  • iso_639_2B = (639-2/B)

  • iso_639_3 = (639-3)

  • family = (Language Family)

  • countries_spoken

Installation

pip install django-languages-plus

Usage

  1. Add languages_plus to your INSTALLED_APPS

  2. Migrate your database and load the language data fixture:

    python manage.py migrate
    python manage.py loaddata languages_data.json.gz
  3. In your code use:

    from languages_plus.models import Language
    lang = Language.objects.get(iso_639_1='en')

Generating Culture Codes (ex: pt_BR)

django-countries-plus(https://pypi.python.org/pypi/django-countries-plus) is now an explicit requirement. After installing both packages you can run the following command once to associate the two datasets and generate a list of culture codes (pt_BR for example):

from languages_plus.utils import associate_countries_and_languages
associate_countries_and_languages()

Requirements

django-countries-plus >= 1.

Django: Tested against the LTS versions of 3, 4, and the latest of 5. Python 3

Running Tests

Does the code actually work?

$ poetry install
$ poetry run pytest

Or for the full tox suite:

$ poetry install
$ pip install tox
$ tox

Metadata

Release files for django-languages-plus 2.1.1

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-languages-plus 2.1.1
File Size Uploaded Provenance
django_languages_plus-2.1.1.tar.gz 28.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-languages-plus 2.1.1
File Interpreter ABI Platform
django_languages_plus-2.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 59.5 kB

Release files / django_languages_plus-2.1.1.tar.gz

Download URL django_languages_plus-2.1.1.tar.gz
Size 28.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e2c4b5448fa9b787fb9d0fb952b53993b72d4fab9784c7815092e0d2b11e73fd
BLAKE2b-256 checksum
How to use checksums
7e78ec1bd0824ebad244d6a23eca287cb19fa019da3a57240c51a7ed456186a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0

Release files / django_languages_plus-2.1.1-py3-none-any.whl

Download URL django_languages_plus-2.1.1-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d3fb829477e45969d3a2f869a771e66135918c238e8ace3e1c481c3a14b8232
BLAKE2b-256 checksum
How to use checksums
d76b5996abd58dfef3de5743442b1baef464dcdc5f25b5fab9fba6aaca81c2af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0

Security for django-languages-plus 2.1.1

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.

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