{ "info": { "author": "Thomas Khyn", "author_email": "thomas@ksytek.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Other Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Internationalization" ], "description": "l18n\n====\n\n|copyright| 2014-2016 Thomas Khyn\n\nLocale internationalization package. Translations for places, timezones ...\n\nTested with the latest minor versions of Python 2 and 3.\n\nSupported languages: English, French, German, Czech, Chinese\n(`want to add yours?`_)\n\n\nWhat is l18n?\n-------------\n\nAs you may have noticed, ``l18n`` is a contraction of ``i18n`` and ``l10n``,\nnamely 'internationalisation' and 'localization'. It basically provides\nlazy translations for names used for localization purposes (e.g. places and\ntimezones).\n\nI started writing ``l18n`` when I was looking for translations for the pytz_\nlibrary. Indeed, on a multi-lingual site where users can select the timezone\nthey are in, it's much better if they can select in their language, as in some\ncases, the differences with the english name can be significant, hence the\nplace to look for it when it's sorted in alphabetical order.\n\nAnd as I am lazy, I thought of a way to - almost - automatically fetch the\ntranslations from the CLDR_ (Unicode's Common Locale Data Repository) database.\n\nIntegrating function to link timezone to country codes, there was no reason not\nto try and provide translations also for the latter. In the near future, I -\nor contributors - may also add currencies or measurement units fetched from\nthe CLDR database ...\n\n\nHow does it work?\n-----------------\n\nTo use ``l18n``, you first need to install it. It works well with ``pip``::\n\n pip install l18n\n\nThen, in your code::\n\n >>> import l18n\n\n``l18n`` exposes several read-only dictionary-like objects:\n\nl18n.tz_cities\n\n is a mapping between all the timezones listed in ``pytz.all_timezones``\n and human-friendly **lazy** versions of the translated name of the city\n in the current language (see `Selecting the language`_ below). For example,\n if the language is English::\n\n >>> l18n.tz_cities['Pacific/Easter']\n L18NLazyString \n >>> str(l18n.tz_cities['Pacific/Easter'])\n 'Easter Island'\n\n In French, it would give::\n\n >>> str(l18n.tz_cities['Pacific/Easter'])\n '\u00cele de P\u00e2ques'\n\nl18n.tz_fullnames\n\n is a mapping between all the timezones listed in ``pytz.all_timezones``\n and **lazy** versions of the timezones' full names in the current language.\n For example::\n\n >>> str(l18n.tz_fullnames['Pacific/Easter'])\n 'Pacific/Easter Island' # or 'Pacifique/\u00cele de P\u00e2ques' in French\n\n It is interesting to note that for 3-components timezone names where the\n local state or territory appears in the city name, ``l18n`` cleverly strips\n this information so that it is not repeated::\n\n >>> str(l18n.tz_fullnames['America/North_Dakota/New_Salem'])\n 'America/North Dakota/New Salem'\n\n indeed::\n\n >>> str(l18n.tz_cities['America/North_Dakota/New_salem'])\n 'New Salem, North Dakota'\n\nl18n.territories\n\n is a mapping between the territory codes as defined in the CLDR_ and their\n localized names, lazily defined. For example::\n\n >>> str(l18n.territories['CZ'])\n 'Czech Republic' # or 'R\u00e9publique Tch\u00e8que' in French\n\n\n.. note::\n\n The values are translated each time they are evaluated, there is no caching.\n This means that the same L18NLazyString / L18NLazyStringsList instance can\n be used and produce 2 different outputs if you change the language between\n the evaluations.\n\n\n.. note::\n\n The values in the above mentionned dictionaries can be overriden by your\n own translations. The dictionaries are not read-only and values can be\n added or removed at your convenience.\n\n\nLazy mappings special features (v.2016.6.3 onwards)\n---------------------------------------------------\n\nThe fore-mentioned ``tz_cities``, ``tz_fullnames`` and ``territories`` are not\nsimple dictionaries and provide additional features.\n\nSorting\n.......\n\nWhen iterating over an ``L18NMap``, the items, keys or values are *yielded* in\nalphabetical order **in the currently selected language**. For performance, the\nresults are cached by language, so the sort is only performed once per language.\nNote that the values are still lazy objects that are evaluated only when\nrendered into a string.\n\nSubsets\n.......\n\nIt is possible to generate a new ``L18NMap`` from an existing one by using the\n``subset`` method and passing an iterable of ``keys`` that need to be kept in\nthe new mapping. Any cached sort is also used to generate the new cache, so\nthat there is nothing to re-calculate in the new subset.\n\nFor example, one can generate a map of translations for\n``pytz.common_timezones``::\n\n >>> common_cities = l18n.tz_cities.subset(pytz.common_timezones.keys())\n\n\nSelecting the language\n----------------------\n\nBy default, when importing ``l18n``, the current default locale is used (via\n``locale.getdefaultlocale()``). If it is not the one you want or if you need to\nchange it, it is rather easy::\n\n >>> l18n.set_language('en')\n >>> str(l18n.tz_cities['Pacific/Easter'])\n 'Easter Island'\n >>> l18n.set_language('fr')\n >>> str(l18n.tz_cities['Pacific/Easter'])\n '\u00cele de P\u00e2ques'\n\nAnd in case you want to disable translation and use raw default strings::\n\n >>> l18n.set_language(None)\n\n\nUtilities\n---------\n\n``l18n`` also exposes a few functions that may be helpful in some cases:\n\n``l18n.utils.get_country_tzs(country_code)``\n\n returns a list of locations for the given country code, sorted in\n alphabetical order in the currently selected language\n\n``l18n.utils.get_country_code_from_tz(timezone)``\n\n returns the country code from a given (untranslated) timezone\n\n\nVersionning\n-----------\n\n``l18n``'s main version number matches ``pytz``'s version number. ``l18n``\n2014.10.X will be fully compatible with ``pytz`` 2014.10 whatever the value of\nX. Indeed, the primary aim is to keep ``l18n``'s translation files consistent\nwith ``pytz``'s timezone names.\n\nBefore ``l18n`` 2016.6, the ``pytz`` version was pinned against the ``l18n``\nversion. Now, ``l18n`` YEAR.MONTH can now be used with any subsequent ``pytz``\nversion. However, note that there may be missing translations if the 2 versions\nare too different from each other. In that case, open an issue_ to request a\nnew version of ``l18n`` to be published.\n\n\n.. _`want to add yours?`:\n\nWant to add a language?\n-----------------------\n\nGreat idea !! Have a look at CONTRIBUTE.rst_.\n\n\nRoadmap\n-------\n\n- Add supported languages\n- Add currencies and other stuff\n\n\n.. |copyright| unicode:: 0xA9\n\n.. _pytz: https://pypi.python.org/pypi/pytz/\n.. _CLDR: http://cldr.unicode.org/\n.. _CONTRIBUTE.rst: https://bitbucket.org/tkhyn/l18n/src/tip/CONTRIBUTE.rst\n.. _issue: https://bitbucket.org/tkhyn/l18n/issues/new\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/tkhyn/l18n", "keywords": "pytz", "license": "", "maintainer": "", "maintainer_email": "", "name": "l18n", "package_url": "https://pypi.org/project/l18n/", "platform": "", "project_url": "https://pypi.org/project/l18n/", "project_urls": { "Homepage": "https://bitbucket.org/tkhyn/l18n" }, "release_url": "https://pypi.org/project/l18n/2018.5/", "requires_dist": null, "requires_python": "", "summary": "Internationalization for pytz timezones and territories", "version": "2018.5" }, "last_serial": 4389313, "releases": { "2014.10.1": [ { "comment_text": "", "digests": { "md5": "0f0c4d50d1c8f2e87b4c847c9747a441", "sha256": "031d6c312566f3724edef4c2b9a214aa68bae88239414e7b88bb542ce87e1cf2" }, "downloads": -1, "filename": "l18n-2014.10.1.zip", "has_sig": false, "md5_digest": "0f0c4d50d1c8f2e87b4c847c9747a441", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29574, "upload_time": "2015-03-16T19:55:02", "url": "https://files.pythonhosted.org/packages/41/95/7de16b8b1b2eb8ad6e5c3676df57f1bdc6e117105ed739779264816cba00/l18n-2014.10.1.zip" } ], "2015.2": [ { "comment_text": "", "digests": { "md5": "218c3f1dbffefc77a6ad99e7a737d293", "sha256": "208369a62199aa9ab399fa21be6c6888082672747c0257fcfe13b0a5499a1a02" }, "downloads": -1, "filename": "l18n-2015.2.zip", "has_sig": false, "md5_digest": "218c3f1dbffefc77a6ad99e7a737d293", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29492, "upload_time": "2015-04-21T13:46:54", "url": "https://files.pythonhosted.org/packages/b4/81/624b766050fe0e1c43ade658929a3ac5d530123f6743d44f921e150433e2/l18n-2015.2.zip" } ], "2015.6": [ { "comment_text": "", "digests": { "md5": "2098a2f9f1ffd9ad4ae765d24c983228", "sha256": "673180f7a505ef628a2682a6a279467834cfb570da62aa47640f921374cf8fca" }, "downloads": -1, "filename": "l18n-2015.6.zip", "has_sig": false, "md5_digest": "2098a2f9f1ffd9ad4ae765d24c983228", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36739, "upload_time": "2015-10-14T15:03:33", "url": "https://files.pythonhosted.org/packages/f7/6f/7bbb7114a96db303063b4c5926dfb45ab9ae82503266e9c6bea323bdba74/l18n-2015.6.zip" } ], "2015.7": [ { "comment_text": "", "digests": { "md5": "6acde44d4ab912df1a6aee92a63cd0e4", "sha256": "fcf2cacaa1f3075741faac047e0e1978130db9ea5430ff8475b716c5a79410cc" }, "downloads": -1, "filename": "l18n-2015.7.zip", "has_sig": false, "md5_digest": "6acde44d4ab912df1a6aee92a63cd0e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36768, "upload_time": "2015-11-25T23:21:45", "url": "https://files.pythonhosted.org/packages/de/79/5802b690377ec698af350f963dcb6fe7c8e04553896cc43b761c5701ceec/l18n-2015.7.zip" } ], "2016.4": [ { "comment_text": "", "digests": { "md5": "1a04bd06d6f76b5169a88ccbd81ac0d3", "sha256": "16e78e36ef28ba1144ead2684102dcaf58dd2a259b77bb57785e80eadf7181f3" }, "downloads": -1, "filename": "l18n-2016.4.zip", "has_sig": false, "md5_digest": "1a04bd06d6f76b5169a88ccbd81ac0d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 43990, "upload_time": "2016-05-05T04:29:56", "url": "https://files.pythonhosted.org/packages/2d/c4/b4a8b6864ef3dc1d8ea6d514a225d32302e9b7276a6c698ceab39fc41839/l18n-2016.4.zip" } ], "2016.6": [ { "comment_text": "", "digests": { "md5": "1817de179ab634268137ff57e2564980", "sha256": "4a097788d13e57b5c6d2a858cecd9002529cf0700416849327748ba0b77aceed" }, "downloads": -1, "filename": "l18n-2016.6.zip", "has_sig": false, "md5_digest": "1817de179ab634268137ff57e2564980", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44532, "upload_time": "2016-07-17T22:45:56", "url": "https://files.pythonhosted.org/packages/cf/ae/c012beed326de10b764be715cc89348326c3f2ac5454737c6d830dc36bf3/l18n-2016.6.zip" } ], "2016.6.1": [ { "comment_text": "", "digests": { "md5": "e6719f292c7b90ff94651f2a6ed3656f", "sha256": "3cb3f62ecc71536cf88d14567fea464608bcf823d84a680a51da568886d19a68" }, "downloads": -1, "filename": "l18n-2016.6.1.zip", "has_sig": false, "md5_digest": "e6719f292c7b90ff94651f2a6ed3656f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44806, "upload_time": "2016-08-18T12:56:10", "url": "https://files.pythonhosted.org/packages/62/b1/fd7503fcd1dc4979225aa6867677db6055bda3e3fee674fc97701a50c2b6/l18n-2016.6.1.zip" } ], "2016.6.2": [ { "comment_text": "", "digests": { "md5": "55ca7b1b90595ae41c594ec995a52449", "sha256": "c5e32c68f901e68a880011f403ead47fdf75db5c167baa3a441d4bdf4d7d84e0" }, "downloads": -1, "filename": "l18n-2016.6.2.zip", "has_sig": false, "md5_digest": "55ca7b1b90595ae41c594ec995a52449", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44821, "upload_time": "2016-08-23T03:11:48", "url": "https://files.pythonhosted.org/packages/ac/de/a33f31eccb0bb273af3efcc74e09d6d746d488ba9776e26821b82bb57346/l18n-2016.6.2.zip" } ], "2016.6.3": [ { "comment_text": "", "digests": { "md5": "fdd7deed7d4698eae8b5edae58cae6f3", "sha256": "c7e2941ea5729d56392027a0df191f1f3d2bac8c8da45bbd6b19f251a0c77a62" }, "downloads": -1, "filename": "l18n-2016.6.3.zip", "has_sig": false, "md5_digest": "fdd7deed7d4698eae8b5edae58cae6f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46767, "upload_time": "2016-08-30T09:37:22", "url": "https://files.pythonhosted.org/packages/e9/9e/9ee8855fc3cddd8410279686d98051ade4e14d5471a44740e3824f48ee34/l18n-2016.6.3.zip" } ], "2016.6.4": [ { "comment_text": "", "digests": { "md5": "66418cc898bcc6e976683571593ff652", "sha256": "a72b9a80b297da5bc807f347bfa61aa9900c35bf1bb55e61a17ec7e58d9e0de7" }, "downloads": -1, "filename": "l18n-2016.6.4.zip", "has_sig": false, "md5_digest": "66418cc898bcc6e976683571593ff652", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 60035, "upload_time": "2016-09-07T03:43:01", "url": "https://files.pythonhosted.org/packages/1d/a9/c514038919f430a9b748e31be06e3b365b1e4a4c1aa04b3990a9870df38d/l18n-2016.6.4.zip" } ], "2018.5": [ { "comment_text": "", "digests": { "md5": "213ceb01946a890e477a5047888727d7", "sha256": "46e72c980d06a7511726f1da10a32fa524f7e2937c0af5ad52d39577024a4382" }, "downloads": -1, "filename": "l18n-2018.5.tar.gz", "has_sig": false, "md5_digest": "213ceb01946a890e477a5047888727d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46673, "upload_time": "2018-10-18T08:08:08", "url": "https://files.pythonhosted.org/packages/db/13/9e3af03e8472b7c234132e6af494437d4b0a2282c8c7f2e80570d12d3d18/l18n-2018.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "213ceb01946a890e477a5047888727d7", "sha256": "46e72c980d06a7511726f1da10a32fa524f7e2937c0af5ad52d39577024a4382" }, "downloads": -1, "filename": "l18n-2018.5.tar.gz", "has_sig": false, "md5_digest": "213ceb01946a890e477a5047888727d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46673, "upload_time": "2018-10-18T08:08:08", "url": "https://files.pythonhosted.org/packages/db/13/9e3af03e8472b7c234132e6af494437d4b0a2282c8c7f2e80570d12d3d18/l18n-2018.5.tar.gz" } ] }