{ "info": { "author": "Sandro Covo", "author_email": "sandro@sandrocovo.ch", "bugtrack_url": null, "classifiers": [ "Framework :: Django", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# django-domain-language\nA django app that allows to swich the language based on the domain the django server is accessed with.\n\nYou might be runing a site called `mysite.com` and want to run the german version of the site under `meineseite.de`\nthis app helps you doing this. You can configure what domain should be served in what language. You can also use it to\nconfigure language specific subdomains like de.mysite.com and fr.mysite.com.\n\n# Installation\nInstall the package with \n```\npython setup.py install\n```\n\nAdd `domain_lang` to the installed apps\n```Python\nINSTALLED_APPS = [\n ...\n 'domain_lang',\n]\n```\n\nAdd the Middleware **after** `LocaleMiddleware`\n```Python\nMIDDLEWARE = [\n ...\n 'django.middleware.locale.LocaleMiddleware',\n 'domain_lang.middleware.DomainLanguageMiddleware',\n ...\n]\n```\n\nIf you want to have access to the configured domains in your templates add `domain_lang.context_processors.domain_language` to the context_processors.\n```\nTEMPLATES = [\n {\n ...\n 'OPTIONS': {\n 'context_processors': [\n ...\n 'domain_lang.context_processors.domain_language',\n ],\n },\n },\n]\n```\n\nFinally run the migrations to create the database tables.\n```\npython manage.py migrate\n```\n\n# Usage\nAfter installing it and runing the django server you will find the DomainLanguageMappings in your admin.\nThere you can configure the domains and their respecitve language. The Middleware will then always set the acitve language based on the domain of the reuqest.\nIf no Mapping is configured for the active domain the language set by `LocaleMiddleware` will be in place.\n\n## Cookies\nYou have to login for each domain seperatly. If you use subdomains for your langauge selection (en.example.com, de.example.com, ...)\nyou can prepend the `SESSION_COOKIE_DOMAIN` with a dot, which will allow you to log in once for all subdomains.\n```\nSESSION_COOKIE_DOMAIN = '.example.com'\n```\n\n## Template Context\nIf you have added `domain_lang.context_processors.domain_language` to your context_processors, all Mappings will be provided\nin the variable called `language_mappings`. You can use this to show links to other versions of your site.\n\n## Template Tag\nThis app provides one template tag that allows you to translate a domain. It will also translate the domain part of the given url according to the configured mappgings\n```Django\n{% load domain_lang %}\n\n{% translate_url 'mysite.com/contact/' 'de' %} # Might be translated to meineseite.de/kontakt/\n```\n\n# LICENSE\n\n django-domain-language is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sacovo/django-domain-language", "keywords": "django translation", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "django-domain-language", "package_url": "https://pypi.org/project/django-domain-language/", "platform": "", "project_url": "https://pypi.org/project/django-domain-language/", "project_urls": { "Homepage": "https://github.com/sacovo/django-domain-language" }, "release_url": "https://pypi.org/project/django-domain-language/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "A django app that allows to swich the language based on the domain", "version": "0.0.1" }, "last_serial": 5560139, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4b4bb966729e71626126b92853b52d6d", "sha256": "e3d1b0354d94da9f600a6fcfe6d0102dcdb874e9651312cdfa3e374998bbdb7a" }, "downloads": -1, "filename": "django_domain_language-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4b4bb966729e71626126b92853b52d6d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22604, "upload_time": "2019-07-20T09:04:21", "url": "https://files.pythonhosted.org/packages/2a/4b/65f8d57e254286beec48161b68047d281e6529f952ffa3ae7a5973c22b9b/django_domain_language-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e3b96bfd79a2ea2d639a6eefa95d991a", "sha256": "21d92605f3012a686db35f7114c4b04efbc74447205db7f120563207b4b9da99" }, "downloads": -1, "filename": "django-domain-language-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e3b96bfd79a2ea2d639a6eefa95d991a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6468, "upload_time": "2019-07-20T09:04:24", "url": "https://files.pythonhosted.org/packages/39/bc/7266e6b3ca11dedc6182c9c016de677d8c3af8270d4e3375780a889468a5/django-domain-language-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4b4bb966729e71626126b92853b52d6d", "sha256": "e3d1b0354d94da9f600a6fcfe6d0102dcdb874e9651312cdfa3e374998bbdb7a" }, "downloads": -1, "filename": "django_domain_language-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4b4bb966729e71626126b92853b52d6d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22604, "upload_time": "2019-07-20T09:04:21", "url": "https://files.pythonhosted.org/packages/2a/4b/65f8d57e254286beec48161b68047d281e6529f952ffa3ae7a5973c22b9b/django_domain_language-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e3b96bfd79a2ea2d639a6eefa95d991a", "sha256": "21d92605f3012a686db35f7114c4b04efbc74447205db7f120563207b4b9da99" }, "downloads": -1, "filename": "django-domain-language-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e3b96bfd79a2ea2d639a6eefa95d991a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6468, "upload_time": "2019-07-20T09:04:24", "url": "https://files.pythonhosted.org/packages/39/bc/7266e6b3ca11dedc6182c9c016de677d8c3af8270d4e3375780a889468a5/django-domain-language-0.0.1.tar.gz" } ] }