{ "info": { "author": "Martin P. Hellwig", "author_email": "martin.hellwig@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3" ], "description": ".. image:: https://img.shields.io/codeship/550d9e60-1630-0134-9ad4-2e1718fe265e/default.svg\n :target: https://bitbucket.org/hellwig/django-g11n\n.. image:: https://coveralls.io/repos/bitbucket/hellwig/django-g11n/badge.svg?branch=default\n :target: https://coveralls.io/bitbucket/hellwig/django-g11n?branch=default\n.. image:: https://img.shields.io/pypi/v/django-g11n.svg\n :target: https://pypi.python.org/pypi/django-g11n/\n.. image:: https://img.shields.io/badge/Donate-PayPal-blue.svg\n :target: https://paypal.me/MartinHellwig\n.. image:: https://img.shields.io/badge/Donate-Patreon-orange.svg\n :target: https://www.patreon.com/hellwig\n \n\n####################\nDjango Globalisation\n####################\n\nWhat is it?\n===========\n\n- A Django app that helps in with internationalisation and localisation.\n\nWhat problem does it solve?\n===========================\n\n- Guess the origin country of the request.\n- Return the currency a country uses.\n- Fetch the language code.\n- Does not use commercial databases, uses original data sources.\n- Both IPv4 and IPv6.\n- Has a reasonable model layout.\n\nHow do I install it?\n====================\n::\n\n $ pip install django-g11n\n\nUse `django-integrator `_ to\nintegrate this app to your django instance, alternatively you can do it the\ncommon manual way.\n\n\nHow do I use it?\n================\n::\n\n # To fill initial data use the command\n $ python manage.py g11n_setup\n # To guess someones IP\n $ python manage.py guess_tld_by_ip 8.8.8.8\n # To find out what the currency is most likely associated with an tld\n $ python manage.py currency_by_tld gb\n #\n\nOf course you most likely want to use it via a request instance, for that have a\nlook at django_g11n.tools.by_request, this has the following functions:\n\n- ipaddress(request)\n- guess_country(request)\n- guess_language(request)\n- guess_currency(request)\n- guess_country_language_currency(request)\n\nThe will return data as you may guess from the functions name.\n\nHowever since all the data is inside models, it is also usuable in an\ninteractive shell session like so:\n\n.. sourcecode:: python\n\t\t\n In [1]: from django_g11n.tools.fetch import iprange_by_ip\n \n In [2]: iprange = iprange_by_ip('194.60.62.36')\n \n In [3]: iprange.__dict__\n Out[3]: \n {'_state': ,\n 'broadcast_hex': '000000000000000000000000c23c3fff',\n 'dts_delete': None,\n 'dts_insert': datetime.datetime(2016, 10, 10, 10, 19, 55, 241150, tzinfo=),\n 'dts_update': None,\n 'id': 58935,\n 'identifier': 'rigb4_0_24_c23c3fff_0_24_c23c0000',\n 'ipv': 4,\n 'network_hex': '000000000000000000000000c23c0000',\n 'reference_id': 235,\n 'regional_nic': 'ripencc',\n 'tld': 'GB'}\n \n In [4]: country = iprange.reference\n \n In [5]: country.__dict__\n Out[5]: \n {'_state': ,\n 'code_2': 'GB',\n 'code_3': 'GBR',\n 'dts_delete': None,\n 'dts_insert': datetime.datetime(2016, 10, 10, 10, 18, 31, 274177, tzinfo=),\n 'dts_update': None,\n 'id': 235,\n 'iso3166': True,\n 'numeric': 826,\n 'obsolete': False}\n \n In [6]: country.languagecountry_set.all()\n Out[6]: []\n \n In [7]: language_country = country.languagecountry_set.all()[0]\n \n In [8]: language_country.language.__dict__\n Out[8]: \n {'_state': ,\n 'bibliographic': 'eng',\n 'code_a2': 'en',\n 'dts_delete': None,\n 'dts_insert': datetime.datetime(2016, 10, 10, 10, 20, 1, 110024, tzinfo=),\n 'dts_update': None,\n 'english': 'English',\n 'french': 'anglais',\n 'id': 123,\n 'iso639_2': True,\n 'obsolete': False,\n 'terminologic': ''}\n \n In [9]: country.countryname_set.all()\n Out[9]: [, ]\n \n In [10]: country.countryname_set.all()[1].__dict__\n Out[10]: \n {'_country_cache': ,\n '_state': ,\n 'country_id': 235,\n 'default': False,\n 'dts_delete': None,\n 'dts_insert': datetime.datetime(2016, 10, 10, 10, 18, 31, 337353, tzinfo=),\n 'dts_update': None,\n 'id': 248,\n 'iso3166': True,\n 'language_id': 42,\n 'value': 'United Kingdom of Great Britain and Northern Ireland'}\n \n In [11]: country.currency_set.all()\n Out[11]: []\n \n In [12]: country.currency_set.all()[0].__dict__\n Out[12]: \n {'_reference_cache': ,\n '_state': ,\n 'code': 'GBP',\n 'country': 'UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND (THE)',\n 'decimals': 2,\n 'default': True,\n 'dts_delete': None,\n 'dts_insert': datetime.datetime(2016, 10, 10, 10, 18, 31, 670707, tzinfo=),\n 'dts_update': None,\n 'id': 754,\n 'is_fund': False,\n 'iso4217': True,\n 'name': 'Pound Sterling',\n 'numeric': 826,\n 'reference_id': 235}\n \n In [13]: country.region_set.all()\n Out[13]: []\n \n In [14]: region = country.region_set.all()[0]\n \n In [15]: region.__dict__\n Out[15]: \n {'_reference_cache': ,\n '_state': ,\n 'dts_delete': None,\n 'dts_insert': datetime.datetime(2016, 10, 10, 10, 20, 1, 369095, tzinfo=),\n 'dts_update': datetime.datetime(2016, 10, 10, 10, 20, 5, 295071, tzinfo=),\n 'english': 'United Kingdom of Great Britain and Northern Ireland',\n 'id': 116,\n 'numeric': '826',\n 'obsolete': False,\n 'reference_id': 235,\n 'unsd_m49': True}\n \n In [16]: def print_regions(region):\n ....: while True:\n ....: print(region.numeric, ' - ', region.english)\n ....: chains = region.chains_region_is_lower.all()\n ....: if chains.count() == 0:\n ....: break\n ....: region = chains[0].upper\n ....: \n \n In [17]: print_regions(region)\n 826 - United Kingdom of Great Britain and Northern Ireland\n 154 - Northern Europe\n 150 - Europe\n 001 - World\n \n In [18]: \n\nAs you can see above that most models refer back to the Country model via\nthe 'reference' field, this is done because most tables are filled from outside\nsource. For country, language and currencies we use ISO, for regions we use\nUN-SD M49 and the ipranges are downloaded from the regional NIC's.\nSince all of them have slightly different representation of the country names,\nthe country names in each table has been preserved on import and after import\nthe system tries to find the appropriate foreign relationship to the Country\ntable.\n\nWhat license is this?\n=====================\nTwo-clause BSD\n\n\nHow can I get support?\n======================\nPlease use the repo's bug tracker to leave behind any questions, feedback,\nsuggestions and comments. I will handle them depending on my time and what looks\ninteresting. If you require guaranteed support please contact me via\ne-mail so we can discuss appropriate compensation.\n\n\nSigning Off\n===========\nIs my work helpful or valuable to you? You can repay me by donating via:\n\nhttps://paypal.me/MartinHellwig\n\n.. image:: https://img.shields.io/badge/PayPal-MartinHellwig-blue.svg\n :target: https://paypal.me/MartinHellwig\n :alt: Donate via PayPal.Me\n :scale: 120 %\n\n-or-\n\nhttps://www.patreon.com/hellwig\n\n.. image:: https://img.shields.io/badge/Patreon-hellwig-orange.svg\n :target: https://www.patreon.com/hellwig\n :alt: Donate via Patreon\n :scale: 120 %\n\n\nThank you!", "description_content_type": null, "docs_url": null, "download_url": "https://bitbucket.org/hellwig/django-g11n/get/1.1.0.1.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/hellwig/django-g11n", "keywords": "django", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "Django-G11N", "package_url": "https://pypi.org/project/Django-G11N/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Django-G11N/", "project_urls": { "Download": "https://bitbucket.org/hellwig/django-g11n/get/1.1.0.1.zip", "Homepage": "https://bitbucket.org/hellwig/django-g11n" }, "release_url": "https://pypi.org/project/Django-G11N/1.1.0.1/", "requires_dist": null, "requires_python": null, "summary": "Django Globalisation Tools", "version": "1.1.0.1" }, "last_serial": 2391236, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "081cb75af56902887c053131d60fcbdc", "sha256": "23598940f149949df6f653b753ce69c815c35d8d0989b1f839764360ae67f2b5" }, "downloads": -1, "filename": "Django-G11N-0.1.0.tar.gz", "has_sig": false, "md5_digest": "081cb75af56902887c053131d60fcbdc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2064, "upload_time": "2016-05-10T22:03:29", "url": "https://files.pythonhosted.org/packages/49/9e/b4fb16e222de6e5f15f230a6304cd77f172311c43622dcbcfaea2da642d2/Django-G11N-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "169c2743e262efd6dab60f3ca9b03405", "sha256": "ece5721b4eb4e54fdaacca8b0780cd0b64a0c1de1d8ea0aec05d162632a4bdd2" }, "downloads": -1, "filename": "Django-G11N-0.1.1.tar.gz", "has_sig": false, "md5_digest": "169c2743e262efd6dab60f3ca9b03405", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2141, "upload_time": "2016-05-10T22:14:06", "url": "https://files.pythonhosted.org/packages/dc/fb/f08fa3ba43b8e9b50a003c88ea3b3e64902a6edcde5fc14af8a0913a1898/Django-G11N-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "9818bde1b4e340c04d7d666da5526159", "sha256": "ec8486d6ca6ff5d62c57ae8b887546ecdd92d753afbe69f38382f25107ee207a" }, "downloads": -1, "filename": "Django-G11N-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9818bde1b4e340c04d7d666da5526159", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2131, "upload_time": "2016-05-10T22:19:47", "url": "https://files.pythonhosted.org/packages/d4/d0/e3bba74de3cb1489242fbf5554c0a402640ceb259202bd4f33858106de11/Django-G11N-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c27f23090db0d759afed7cf26bba69db", "sha256": "9e0804c2fddd675c7cebdf6459f1bd3d23b71b8397ad672c274bf1dcdb9a14ea" }, "downloads": -1, "filename": "Django-G11N-0.1.3.tar.gz", "has_sig": false, "md5_digest": "c27f23090db0d759afed7cf26bba69db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16749, "upload_time": "2016-05-11T13:12:47", "url": "https://files.pythonhosted.org/packages/bc/f9/6bffa9568f7d191f81e4610adbdf26540e9e823b4d30ccceeb4476aec73a/Django-G11N-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "c20f7b1af428f726d5664dca66a54438", "sha256": "acdf1049b2a47dcab9c166573932aff823516cc892dae10336094e110df6a7e5" }, "downloads": -1, "filename": "Django-G11N-0.1.4.tar.gz", "has_sig": false, "md5_digest": "c20f7b1af428f726d5664dca66a54438", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16953, "upload_time": "2016-05-18T09:44:12", "url": "https://files.pythonhosted.org/packages/00/87/76d5081cf463341dd9078352ddb6b8a9ff86f7dde21986b5c9e1a845c3b4/Django-G11N-0.1.4.tar.gz" } ], "1.0.0.1": [ { "comment_text": "", "digests": { "md5": "aa925eda9968e5df3d6be9948d06ce45", "sha256": "482811b47c72894d0c1bff5c30c67f3e69cffa19c31067d8038c06977fa36b72" }, "downloads": -1, "filename": "Django-G11N-1.0.0.1.tar.gz", "has_sig": false, "md5_digest": "aa925eda9968e5df3d6be9948d06ce45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21287, "upload_time": "2016-06-27T12:32:26", "url": "https://files.pythonhosted.org/packages/af/0c/84ac32bbe0f7faf1184d338f4fb131f5021a2bc50ffcf1d21a34ab39112f/Django-G11N-1.0.0.1.tar.gz" } ], "1.0.1.1": [ { "comment_text": "", "digests": { "md5": "57ad1e238706364e230aef2375b89ed0", "sha256": "c40061176313d00e1f00cef95e0e63d2af7cf19133ecd6e9fc989959d4f16ed4" }, "downloads": -1, "filename": "Django-G11N-1.0.1.1.tar.gz", "has_sig": false, "md5_digest": "57ad1e238706364e230aef2375b89ed0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21290, "upload_time": "2016-06-28T14:20:07", "url": "https://files.pythonhosted.org/packages/1d/0c/59e2da81c6386b27bf14a0ac1ec72841fff57a9fecbd3b3cbac3093b7a36/Django-G11N-1.0.1.1.tar.gz" } ], "1.0.2.1": [ { "comment_text": "", "digests": { "md5": "4d17517999df1026d80f8c87fcf71f06", "sha256": "e4cb3aafe2fafe1f842337cb95e83e9e188cbf8e0ada6cec9e12909d852e977d" }, "downloads": -1, "filename": "Django-G11N-1.0.2.1.tar.gz", "has_sig": false, "md5_digest": "4d17517999df1026d80f8c87fcf71f06", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21284, "upload_time": "2016-06-28T14:58:38", "url": "https://files.pythonhosted.org/packages/9c/fc/82b2a60458036805157ca136181a37d3a58e8a1343935404104fa55aef5f/Django-G11N-1.0.2.1.tar.gz" } ], "1.0.2.2": [ { "comment_text": "", "digests": { "md5": "fb817d475511c25d24b131e1824f7d5f", "sha256": "094526074eb52d3d7ff41f0f586471bf511c4d1181c917f9af8e146f0d850517" }, "downloads": -1, "filename": "Django-G11N-1.0.2.2.tar.gz", "has_sig": false, "md5_digest": "fb817d475511c25d24b131e1824f7d5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21287, "upload_time": "2016-07-02T16:30:55", "url": "https://files.pythonhosted.org/packages/11/be/fe3a089b2872f53b7247e440d57f5744862b46d3912d01da60ad056bfeab/Django-G11N-1.0.2.2.tar.gz" } ], "1.0.2.3": [ { "comment_text": "", "digests": { "md5": "9711ec84f852aef642823f99ac182c4e", "sha256": "885a83cdd6a0c343cad4b7e90b49321b06965627aa55b5f186670f16c2ab273e" }, "downloads": -1, "filename": "Django-G11N-1.0.2.3.tar.gz", "has_sig": false, "md5_digest": "9711ec84f852aef642823f99ac182c4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21947, "upload_time": "2016-09-14T01:08:54", "url": "https://files.pythonhosted.org/packages/6b/24/c76887552dc077ba03b2432a77203d813f64d83589ae7b813306ed62d3e5/Django-G11N-1.0.2.3.tar.gz" } ], "1.1.0.1": [ { "comment_text": "", "digests": { "md5": "a035b5f0f8b1b310849f2276945081df", "sha256": "1c44a858d0bd8732be334627883c27ee4351116a8965cd60f65301a277386c16" }, "downloads": -1, "filename": "Django-G11N-1.1.0.1.tar.gz", "has_sig": false, "md5_digest": "a035b5f0f8b1b310849f2276945081df", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28915, "upload_time": "2016-10-10T15:56:01", "url": "https://files.pythonhosted.org/packages/2b/cb/56e46242de9a14661df8233022d7ee3c2e569e57fb592706177fc1ddf470/Django-G11N-1.1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a035b5f0f8b1b310849f2276945081df", "sha256": "1c44a858d0bd8732be334627883c27ee4351116a8965cd60f65301a277386c16" }, "downloads": -1, "filename": "Django-G11N-1.1.0.1.tar.gz", "has_sig": false, "md5_digest": "a035b5f0f8b1b310849f2276945081df", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28915, "upload_time": "2016-10-10T15:56:01", "url": "https://files.pythonhosted.org/packages/2b/cb/56e46242de9a14661df8233022d7ee3c2e569e57fb592706177fc1ddf470/Django-G11N-1.1.0.1.tar.gz" } ] }