{ "info": { "author": "Silvio Luis Leite", "author_email": "silviolleite@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.1", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries" ], "description": "Django Translation Flags\n========================\n\n|Build Status| |Maintainability| |codecov| |PyPI - Downloads| |PyPI -\nVersion|\n\nThis Django app provides integration for translation options in\ntemplates with some most common standard world languages. This is useful\nfow when you need to display language options in yours Django Apps.\n\nRequirements\n============\n\nDjango Translation Flags require Django Internationalization and\nlocalization properly configured. You can see more about these settings\nin https://docs.djangoproject.com/en/2.1/topics/i18n/\n\nBasically you need to:\n\n1. Define a custom ``LANGUAGES`` list on ``settings.py`` with tuples,\n i.e:\n\n.. code:: python\n\n from django.utils.translation import gettext_lazy as _\n\n LANGUAGES = [\n ('de', _('German')),\n ('en', _('English')),\n ('pt-br', _('Brazilian Portuguese'))\n ]\n\nOnly languages listed in the ``LANGUAGES`` setting can be selected. This\nexample restricts languages that are available for automatic selection\nto German, English and Brazilian Portuguese\n\n2. Add Middleware\n\nTo use LocaleMiddleware, add \u2018django.middleware.locale.LocaleMiddleware\u2019\nto your MIDDLEWARE setting. Because middleware order matters, follow\nthese guidelines:\n\n- Make sure it\u2019s one of the first middleware installed.\n- It should come after SessionMiddleware, because LocaleMiddleware\n makes use of session data. And it should come before CommonMiddleware\n because CommonMiddleware needs an activated language in order to\n resolve the requested URL. If you use CacheMiddleware, put\n LocaleMiddleware after it.\n\nFor example, your MIDDLEWARE might look like this:\n\n.. code:: python\n\n MIDDLEWARE = [\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.middleware.locale.LocaleMiddleware',\n 'django.middleware.common.CommonMiddleware',\n ]\n\n3. Markup the text to translation:\n\nThe format of ``.po`` files is straightforward. Each ``.po`` file\ncontains a small bit of metadata, such as the translation maintainer\u2019s\ncontact information, but the bulk of the file is a list of messages \u2013\nsimple mappings between translation strings and the actual translated\ntext for the particular language.\n\nFor instance, if your Django app contained a translation string for the\ntext \u201cWelcome to my site.\u201d, like so:\n\n.. code:: python\n\n from django.utils.translation import gettext_lazy as _\n _(\"Welcome to my site.\")\n\n\u2026then ``django-admin makemessages`` will have created a ``.po`` file\ncontaining the following snippet \u2013 a message:\n\n.. code:: text\n\n #: path/to/python/module.py:23\n msgid \"Welcome to my site.\"\n msgstr \"\"\n\n4. Generate and compile it using the commands bellow:\n\n- The first step is to create a message file for a new language:\n\n.. code:: bash\n\n django-admin makemessages -l de -l en -l pt_BR\n\n- Compiling message files after creating your message file:\n\n.. code:: bash\n\n django-admin compilemessages\n\nFor more detailed information on how to create language files it is\nsuggested to read the documentation:\nhttps://docs.djangoproject.com/en/2.1/topics/i18n/translation/#how-to-create-language-files\n\nInstall\n=======\n\nInstall from PyPI:\n\n::\n\n pip install django-translation-flags\n\nConfiguration\n=============\n\nAdd ``django-translation-flags`` to your list of ``INSTALLED_APPS`` in\nsettings.py:\n\n.. code:: python\n\n INSTALLED_APPS = [\n ...\n 'django_translation_flags',\n ...\n ]\n\nAdd the Django Translation Flags URLs to ``urls.py``:\n\n.. code:: python\n\n from django.conf.urls import url, include\n\n urlpatterns = [\n ...\n path('i18n/', include('django_translation_flags.urls')),\n ...\n ]\n\nInject the required meta tags in your ``base.html`` (or wherever your\nHTML is defined):\n\n.. code:: html\n\n {% load flags %}\n\n \n\nBy default it will show the rectangular icons, but you can change it to\n``square``:\n\n.. code:: html\n\n {% load flags %}\n\n \n\nOptionally you can set your custom class for HTML tags:\n\n.. code:: html\n\n {% load flags %}\n\n \n\nThe ``languages`` template tags accept ``**kwargs`` to configure the\nclass to HTML tags. So you can set the classes to these HTML tags:\n\n**li_class**: Class to ``li`` tag (Default: empty)\n\n**a_class**: Class to ``a`` tag (Default: empty)\n\nThe HTML structure is:\n\n.. code:: html\n\n
  • \n \n \n \n
  • \n\nHow does it work?\n=================\n\nThe Django Translation Flags has a ``CSS`` file where all the most\nimportant languages flags are configured.\n\nThe avaliable flags are:\n\n``af``: Afrikaans, ``ar``: Arabic, ``az``: Azerbaijani, ``de``: German,\n``en``: English, ``en-au``: Australian English, ``es``: Spanish,\n``es-ar``: Argentinian Spanish, ``es-mx``: Mexican Spanish, ``fr``:\nFrench, ``hi``: Hindi, ``hu``: Hungarian, ``id``: Indonesian, ``it``:\nItalian, ``ja``: Japanese, ``ko``: Korean, ``nl``: Dutch (Nederlands),\n``pl``: Polish, ``pt``: Portuguese, ``pt-br``: Brazilian Portuguese,\n``ru``: Russian, ``sv``: Swedish, ``tr``: Turkish, ``uk``: Ukrainian,\n``zh-cn``: Simplified Chinese, ``zh-hans``: Simplified Chinese and\n``zh-hant``: Traditional Chinese.\n\n|image5|\n\nThe App get the language code from ``LANGUAGES`` on ``settings.py`` and\nthen it concatenates the language codes with the name of the icon class\nand shows the correct flags..\n\nSee the all Django supported languages in module\n``django.conf.locale.LANG_INFO`` *LANG_INFO is a dictionary structure to\nprovide meta information about languages.*\n\nFeedback\n========\n\nFeedback and pull requests are strongly encouraged and kindly\nappreciated (-:\n\nContributing\n============\n\nPython\n^^^^^^\n\n1. Clone the repository.\n2. Create a virtualenv with Python 3.6 or 3.7\n3. Active the virtualenv.\n4. Install the dependencies.\n5. Run the tests.\n\n.. code:: console\n\n git clone https://github.com/silviolleite/django-translation-flags\n cd django-translation-flags\n python -m venv .venv\n .venv/bin/activate\n pip install -r requirements.txt\n python runtests.py\n\nLess to CSS\n^^^^^^^^^^^\n\nYou will need of ``node`` and ``npm`` previously installed.\n\n1. Install the dependencies\n2. Run the gulp\n3. Edit the less files: ``/assets/less/``\n\n.. code:: console\n\n npm install\n npm run build\n\nLicensing\n=========\n\nAll files in this repository are distributed under the MIT license.\n\n.. |Build Status| image:: https://travis-ci.org/silviolleite/django-translation-flags.svg\n :target: https://travis-ci.org/silviolleite/django-translation-flags\n.. |Maintainability| image:: https://api.codeclimate.com/v1/badges/1d00a2cbf958477ca97e/maintainability\n :target: https://codeclimate.com/github/silviolleite/django-translation-flags/maintainability\n.. |codecov| image:: https://codecov.io/gh/silviolleite/django-translation-flags/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/silviolleite/django-translation-flags\n.. |PyPI - Downloads| image:: https://img.shields.io/pypi/dd/django-translation-flags.svg\n :target: https://pypi.org/project/django-pwa/\n.. |PyPI - Version| image:: https://img.shields.io/pypi/v/django-translation-flags.svg\n :target: https://pypi.org/project/django-translation-flags\n.. |image5| image:: assets/img/flags.png\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/silviolleite/django-translation-flags", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "django-translation-flags", "package_url": "https://pypi.org/project/django-translation-flags/", "platform": "", "project_url": "https://pypi.org/project/django-translation-flags/", "project_urls": { "Homepage": "http://github.com/silviolleite/django-translation-flags" }, "release_url": "https://pypi.org/project/django-translation-flags/1.0.6/", "requires_dist": null, "requires_python": "", "summary": "Internationalization with flags of main languages, It lets easy to integrate the Django i18n in yours templates", "version": "1.0.6" }, "last_serial": 5146510, "releases": { "1.0.3": [ { "comment_text": "", "digests": { "md5": "3bcf47ca819ceed32ddb3c4cff4e0b22", "sha256": "eb932f280d0ea0afc35343fe9e6d72c2e709ec7b27d0960f1cfdf6fa82cb707d" }, "downloads": -1, "filename": "django_translation_flags-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3bcf47ca819ceed32ddb3c4cff4e0b22", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 158872, "upload_time": "2018-11-30T10:59:10", "url": "https://files.pythonhosted.org/packages/bd/a7/a6d63716d90721394ddb46be56d5bb7e8131bf163f13b5a8ce3982081bbc/django_translation_flags-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6fcc7e375fb82e8785be76c43352d578", "sha256": "a85211d757fa63ec41db595286fb44eb0482b9e21a80c4b28e1adaf21a7d1b15" }, "downloads": -1, "filename": "django-translation-flags-1.0.3.tar.gz", "has_sig": false, "md5_digest": "6fcc7e375fb82e8785be76c43352d578", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 140427, "upload_time": "2018-11-30T10:59:12", "url": "https://files.pythonhosted.org/packages/71/ea/d6abcf6e1968b259533e5d692eb8d3a35fc727401d6193ec51c717e3b7c5/django-translation-flags-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "302e32af5a7a7a2b247d77b5164e8db1", "sha256": "16218366b6dafd7efc1a85c313ba61835dea5914b39bd592937b52fe9c377ad9" }, "downloads": -1, "filename": "django_translation_flags-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "302e32af5a7a7a2b247d77b5164e8db1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 159159, "upload_time": "2018-11-30T13:10:48", "url": "https://files.pythonhosted.org/packages/5d/d7/d4198991af837934157e138a6c3bdf8d4af3b7f630bc3b8d57e78c6ed157/django_translation_flags-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1c8fb25ae0213fd0a4516e37a61604cd", "sha256": "c9c3abe075d69ddcda7c01b611d2b34fd563fa1b5bd0626d640d9bd6aa1e55f6" }, "downloads": -1, "filename": "django-translation-flags-1.0.4.tar.gz", "has_sig": false, "md5_digest": "1c8fb25ae0213fd0a4516e37a61604cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 141050, "upload_time": "2018-11-30T13:10:50", "url": "https://files.pythonhosted.org/packages/68/ac/afb7602382f03b27256f61ca06de17be3e96f698ac0e745f9e7162e29582/django-translation-flags-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "39e1124e39b898efe3f71b3fc5eaaa44", "sha256": "f4151b9290dcbb79f8e6b360e434b2a266cfeb48708b807bae3eeded585c9054" }, "downloads": -1, "filename": "django_translation_flags-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "39e1124e39b898efe3f71b3fc5eaaa44", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 159240, "upload_time": "2019-04-10T12:59:47", "url": "https://files.pythonhosted.org/packages/64/99/91a193149aec69277b133cf5b380fc2ccb63d95747cf396e61ed1b05c3c7/django_translation_flags-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "766c3305c1ec5a18d0079f5577dc4f9b", "sha256": "86d0bf552ca03e68ff586b31a62976502aae81c4c7fbc07c5a1cd45cec869a5c" }, "downloads": -1, "filename": "django-translation-flags-1.0.5.tar.gz", "has_sig": false, "md5_digest": "766c3305c1ec5a18d0079f5577dc4f9b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 141134, "upload_time": "2019-04-10T12:59:49", "url": "https://files.pythonhosted.org/packages/9f/2d/a88625b48e519e3193863d2fe549f76bc1c23896ee316ebecffcc56c5966/django-translation-flags-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "17a30f0ad3f16465a0017622f4b64b22", "sha256": "9ea9fbbe206212c3509a366acb5a86407b5b5e4b5b1d3cfb49b8e7cc774b9577" }, "downloads": -1, "filename": "django_translation_flags-1.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "17a30f0ad3f16465a0017622f4b64b22", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 159457, "upload_time": "2019-04-15T19:53:38", "url": "https://files.pythonhosted.org/packages/90/72/edbf0589f391b0ad98313e7cb52a8fbb6d1be6b4219fddba414fca103a1c/django_translation_flags-1.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5ffe2e8b7fc53a7ab34ec8a3f8a984fe", "sha256": "c54973fdb4b570831c2e59bbb2ff05c5827d9a6c080923c97292b27427f8c17d" }, "downloads": -1, "filename": "django-translation-flags-1.0.6.tar.gz", "has_sig": false, "md5_digest": "5ffe2e8b7fc53a7ab34ec8a3f8a984fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 141328, "upload_time": "2019-04-15T19:53:40", "url": "https://files.pythonhosted.org/packages/58/e5/71b312cc37cfe6d61b8d5848a29c27723ac6abac1bbc70ed4af8fc2b6a47/django-translation-flags-1.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "17a30f0ad3f16465a0017622f4b64b22", "sha256": "9ea9fbbe206212c3509a366acb5a86407b5b5e4b5b1d3cfb49b8e7cc774b9577" }, "downloads": -1, "filename": "django_translation_flags-1.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "17a30f0ad3f16465a0017622f4b64b22", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 159457, "upload_time": "2019-04-15T19:53:38", "url": "https://files.pythonhosted.org/packages/90/72/edbf0589f391b0ad98313e7cb52a8fbb6d1be6b4219fddba414fca103a1c/django_translation_flags-1.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5ffe2e8b7fc53a7ab34ec8a3f8a984fe", "sha256": "c54973fdb4b570831c2e59bbb2ff05c5827d9a6c080923c97292b27427f8c17d" }, "downloads": -1, "filename": "django-translation-flags-1.0.6.tar.gz", "has_sig": false, "md5_digest": "5ffe2e8b7fc53a7ab34ec8a3f8a984fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 141328, "upload_time": "2019-04-15T19:53:40", "url": "https://files.pythonhosted.org/packages/58/e5/71b312cc37cfe6d61b8d5848a29c27723ac6abac1bbc70ed4af8fc2b6a47/django-translation-flags-1.0.6.tar.gz" } ] }