{ "info": { "author": "Mohammad Abbas", "author_email": "mohammad.abbas86@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "=====================\ndjango-right-to-left\n=====================\n\n-------\nSummary\n-------\nA Django template loader that looks for an alternative right to left version of a template file if the activated language is a right to left language such as Arabic or Hebrew. \n\nThis provides a clean and easy way to customise the markup in your templates without having to place conditional logic in your templates.\n\nThe most common use case for this would be a Django website that supports both a left to right and right to left language, such as English and Arabic.\n\n-------\nExample\n-------\nSuppose you had the following Django template::\n\n # homepage.html\n {% extends \"layout.html\" %}\n \n {% block content %}\n
...
\n
...
\n {% endblock %}\n\nTo swap the content around when the activated language is Arabic, an IF statement would have to be wrapped around the div tags. This may be a feasible solution for small templates but for most templates this will make the template very hard to read and messy. \n\nUsing the django-right-to-left template loader makes this process a lot cleaner by allowing you to create an alternative template with the same name but with \"_rtl\" appended to the file name. In this example, a file called \"homepage_rtl.html\" will be picked up as the alternative.\n\nNow when a template is rendered, regardless of whether it is rendered by a Django view or by extending another template using the \"extends\" block or included using the \"include\" block, the django-right-to-left template loader will look to see if an alternative template suffixed with \"_rtl\" exists. If it doesn't exist it will load the standard version of the template.\n\n------------\nInstallation\n------------\n\nYou can install django-right-to-left using pip::\n\n $ pip install django-right-to-left\n\nor easy_install::\n\n $ easy_install django-right-to-left\n\n------------\nInstructions\n------------\n\ndjango-right-to-left works in exactly the same way as the Django `cached template loader `_.\nThe django-right-to-left template loader is a class-based loader that you configure with a list of other loaders that it should wrap.\n\nSimply wrap the template loaders defined in your settings file with the django-right-to-left-loader.\n\nFor example, if you are currently using the filesystem loader and app_directories loader, \nchange the ``TEMPLATE_LOADERS`` settings from::\n\n TEMPLATE_LOADERS = (\n 'django.template.loaders.filesystem.Loader',\n 'django.template.loaders.app_directories.Loader',\n )\n\nto this::\n\n TEMPLATE_LOADERS = (\n ('rtl.loaders.Loader', (\n 'django.template.loaders.filesystem.Loader',\n 'django.template.loaders.app_directories.Loader',\n )),\n )\n\nThat's all there is to it. All you have to do now is create your alternative templates, ensuring that the string \"_rtl\" is appended to the filename. So the alternative template for \"homepage.html\" will be \"homepage_rtl.html\".\n\n------------------\nRunning the tests\n------------------\n\ndjango-right-to-left has a small but extensive test suite. You can run the tests by running the \nfollowing commands, assuming you \nhave `virtualenvwrapper `_ installed::\n\n $ git clone git@github.com:abbas123456/django-right-to-left.git\n $ cd django-right-to-left\n $ mkvirtualenv django-right-to-left\n $ pip install -r requirements.txt\n $ ./runtests.py", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/abbas123456/django-right-to-left", "keywords": "Django,translation,internationalization,righ to left,bidi", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-right-to-left", "package_url": "https://pypi.org/project/django-right-to-left/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-right-to-left/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/abbas123456/django-right-to-left" }, "release_url": "https://pypi.org/project/django-right-to-left/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "A Django template loader that looks for an alternative right to left version of a template file if the activated language is a right to left language such as Arabic or Hebrew.", "version": "0.1.1" }, "last_serial": 790504, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "29c60d2633f1c825799e25f6d7afc2fc", "sha256": "9018fa3a560eac5139942a2c24f7f16ad7df5811e2338db86ba59356f72b7178" }, "downloads": -1, "filename": "django-right-to-left-0.1.linux-i686.exe", "has_sig": false, "md5_digest": "29c60d2633f1c825799e25f6d7afc2fc", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 69606, "upload_time": "2013-02-27T00:23:58", "url": "https://files.pythonhosted.org/packages/68/d2/43e2a6764215a5eafc4706f034e8a65ce10e45c6a27782633a47a2197d98/django-right-to-left-0.1.linux-i686.exe" }, { "comment_text": "", "digests": { "md5": "6f83432ab3c5aaa959156ae1b2771f34", "sha256": "d5ca475cb5eab0147b8ab840bcbf93331770ceb0b280f11611226796e86ddd9a" }, "downloads": -1, "filename": "django-right-to-left-0.1.tar.gz", "has_sig": false, "md5_digest": "6f83432ab3c5aaa959156ae1b2771f34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4331, "upload_time": "2013-02-27T00:23:54", "url": "https://files.pythonhosted.org/packages/96/14/edd217e54baa622110bc0b94ad815d3af9379659a293e8ffa77963a7020b/django-right-to-left-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "46302fb3aeaf8eb54d98cf37871a581e", "sha256": "8ac7afbb0491796c9c6c4e3f6d068f5cb1c356820dc74db3c85a1f49a9b547a9" }, "downloads": -1, "filename": "django-right-to-left-0.1.1.tar.gz", "has_sig": false, "md5_digest": "46302fb3aeaf8eb54d98cf37871a581e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4279, "upload_time": "2013-02-27T15:08:35", "url": "https://files.pythonhosted.org/packages/3c/b9/63e2a7d439fcffcd3d7e5d76ff0ba03bbaa558fe6b5137bd5dde4441c273/django-right-to-left-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "46302fb3aeaf8eb54d98cf37871a581e", "sha256": "8ac7afbb0491796c9c6c4e3f6d068f5cb1c356820dc74db3c85a1f49a9b547a9" }, "downloads": -1, "filename": "django-right-to-left-0.1.1.tar.gz", "has_sig": false, "md5_digest": "46302fb3aeaf8eb54d98cf37871a581e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4279, "upload_time": "2013-02-27T15:08:35", "url": "https://files.pythonhosted.org/packages/3c/b9/63e2a7d439fcffcd3d7e5d76ff0ba03bbaa558fe6b5137bd5dde4441c273/django-right-to-left-0.1.1.tar.gz" } ] }