=============================
Django Languages Plus
=============================
.. image:: https://badge.fury.io/py/django-languages-plus.svg
:target: https://badge.fury.io/py/django-languages-plus
.. image:: https://github.com/cordery/django-languages-plus/actions/workflows/tox.yml/badge.svg
:target: https://github.com/cordery/django-languages-plus/actions/workflows/tox.yml
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
Raw data
{
"_id": null,
"home_page": "https://github.com/cordery/django-languages-plus",
"name": "django-languages-plus",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4",
"maintainer_email": "",
"keywords": "django-languages-plus",
"author": "Andrew Cordery",
"author_email": "cordery@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7e/78/ec1bd0824ebad244d6a23eca287cb19fa019da3a57240c51a7ed456186a0/django_languages_plus-2.1.1.tar.gz",
"platform": null,
"description": "=============================\nDjango Languages Plus\n=============================\n\n.. image:: https://badge.fury.io/py/django-languages-plus.svg\n :target: https://badge.fury.io/py/django-languages-plus\n\n.. image:: https://github.com/cordery/django-languages-plus/actions/workflows/tox.yml/badge.svg\n :target: https://github.com/cordery/django-languages-plus/actions/workflows/tox.yml\n\n\ndjango-languages-plus provides models and fixtures for working with both common languages and 'culture codes' or locale codes, like pt-BR.\n\nNote 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.\n\nThe Language model contains all ISO 639-1 languages and related information from http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\n\nThe model provides the following fields (original wikipedia.org column name in parentheses).\n\n* name_en (ISO Language Name)\n* name_native (Native Name)\n* iso_639_1 (639-1)\n* iso_639_2T = (639-2/T)\n* iso_639_2B = (639-2/B)\n* iso_639_3 = (639-3)\n* family = (Language Family)\n* countries_spoken\n\n\n------------\nInstallation\n------------\n\n::\n\n pip install django-languages-plus\n\n\n------------\nUsage\n------------\n\n1. Add ``languages_plus`` to your INSTALLED_APPS\n\n2. Migrate your database and load the language data fixture::\n\n python manage.py migrate\n python manage.py loaddata languages_data.json.gz\n\n3. In your code use::\n\n from languages_plus.models import Language\n lang = Language.objects.get(iso_639_1='en')\n\n---------------------------------------\nGenerating Culture Codes (ex: pt_BR)\n---------------------------------------\ndjango-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)::\n\n from languages_plus.utils import associate_countries_and_languages\n associate_countries_and_languages()\n\n---------------------------------------\nRequirements\n---------------------------------------\ndjango-countries-plus >= 1.\n\nDjango: Tested against the LTS versions of 3, 4, and the latest of 5.\nPython 3\n\n\nRunning Tests\n-------------\n\nDoes the code actually work?\n\n::\n\n $ poetry install\n $ poetry run pytest\n\nOr for the full tox suite:\n\n::\n\n $ poetry install\n $ pip install tox\n $ tox\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A django model & fixture containing common languages and culture codes",
"version": "2.1.1",
"project_urls": {
"Homepage": "https://github.com/cordery/django-languages-plus",
"Repository": "https://github.com/cordery/django-languages-plus"
},
"split_keywords": [
"django-languages-plus"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d76b5996abd58dfef3de5743442b1baef464dcdc5f25b5fab9fba6aaca81c2af",
"md5": "dfdd79ff0f6a7c2a75708bef1179c45f",
"sha256": "3d3fb829477e45969d3a2f869a771e66135918c238e8ace3e1c481c3a14b8232"
},
"downloads": -1,
"filename": "django_languages_plus-2.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dfdd79ff0f6a7c2a75708bef1179c45f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4",
"size": 31382,
"upload_time": "2024-01-11T11:41:56",
"upload_time_iso_8601": "2024-01-11T11:41:56.556238Z",
"url": "https://files.pythonhosted.org/packages/d7/6b/5996abd58dfef3de5743442b1baef464dcdc5f25b5fab9fba6aaca81c2af/django_languages_plus-2.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7e78ec1bd0824ebad244d6a23eca287cb19fa019da3a57240c51a7ed456186a0",
"md5": "2e07468f74d73fdeb88893dd67163aa8",
"sha256": "e2c4b5448fa9b787fb9d0fb952b53993b72d4fab9784c7815092e0d2b11e73fd"
},
"downloads": -1,
"filename": "django_languages_plus-2.1.1.tar.gz",
"has_sig": false,
"md5_digest": "2e07468f74d73fdeb88893dd67163aa8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4",
"size": 28116,
"upload_time": "2024-01-11T11:41:58",
"upload_time_iso_8601": "2024-01-11T11:41:58.065212Z",
"url": "https://files.pythonhosted.org/packages/7e/78/ec1bd0824ebad244d6a23eca287cb19fa019da3a57240c51a7ed456186a0/django_languages_plus-2.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-11 11:41:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cordery",
"github_project": "django-languages-plus",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "django-languages-plus"
}