{ "info": { "author": "RedTurtle Technology", "author_email": "sviluppoplone@redturtle.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Plone", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Programming Language :: Python" ], "description": ".. contents::\r\n\r\nIntroduction\r\n============\r\n\r\nThis product can be used by people that want to use an `strftime compatible format`__ for display\r\nlocale sensible data inside Plone templates.\r\n\r\n__ http://docs.python.org/library/time.html#time.strftime\r\n\r\nThe Python Way\r\n--------------\r\n\r\nPython support locales through the `locale module`__ but this seems not working properly inside Plone,\r\nfor example the `setlocale function`__ says:\r\n\r\n setlocale() is not thread-safe on most systems. Applications typically start with a call of\r\n \r\n >>> import locale\r\n >>> locale.setlocale(locale.LC_ALL, '')\r\n \r\n This sets the locale for all categories to the user\u2019s default setting (typically specified in the\r\n LANG environment variable). If the locale is not changed thereafter, using multithreading should not\r\n cause problems.\r\n\r\n__ http://docs.python.org/library/locale.html\r\n__ http://docs.python.org/library/locale.html#locale.setlocale\r\n\r\nSo it seems that you can force a locale (or use the system ones) but I fear this is not a good idea for Plone\r\nsites that need to be used in more than a language. Plone itself don't use the Python locales for translate dates\r\nelements.\r\n\r\nThe Plone Way\r\n-------------\r\n\r\nInside Plone you can print date in a full working i18n aware way using the ``toLocalizedTime`` method of the\r\n``ploneview``. However you can simply use a couple of format: *long_format* or *short_format*, defined in the\r\nPlone localization product, passing ``True`` or ``False`` as second parameter:\r\n\r\n >>> from DateTime import DateTime\r\n >>> t = DateTime()\r\n >>> ploneview.toLocalizedTime(t, True)\r\n\r\nAlternative\r\n===========\r\n\r\nInstalling this product will give you an alternative, patching Plone. You can continue using ``toLocalizedTime``\r\nbut you can play with the ``long_format`` parameter, that in fact became also a *format* parameter.\r\n\r\nYou can still use the method as above (so basic Plone features are not touched) but you can provide a\r\n``long_format`` value that can be a format string.\r\n\r\nFor example, a valid Python date string format as \"``%a %d hello guys %b %Y``\" became\r\n\"``${a} ${d} hello guys ${b} ${Y}``\", so:\r\n\r\n >>> from DateTime import DateTime\r\n >>> t = DateTime()\r\n >>> ploneview.toLocalizedTime(t, \"${a} ${d} hello guys ${b} ${Y}\")\r\n\r\nWarning\r\n-------\r\n\r\nMaybe this product is wrong and there is a way to make strftime working properly in a Plone multi-language site,\r\nbut I don't find any information about an alternative way! If you know how to do this, please contribute\r\nto `the discussion`__ and help me deprecate this add-on!\r\n\r\n__ http://permalink.gmane.org/gmane.comp.web.zope.plone.user/114706\r\n\r\nAuthors\r\n=======\r\n\r\nThis product was developed by RedTurtle Technology team.\r\n\r\n.. image:: http://www.redturtle.it/redturtle_banner.png\r\n :alt: RedTurtle Technology Site\r\n :target: http://www.redturtle.it/\r\n\r\nChangelog\r\n=========\r\n\r\n0.1.0 (2011-07-21)\r\n------------------\r\n\r\n* Initial release", "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/RedTurtle/experimental.ulocalized_time", "keywords": "plone date localization i18n plonegov i10n", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "experimental.ulocalized_time", "package_url": "https://pypi.org/project/experimental.ulocalized_time/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/experimental.ulocalized_time/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/RedTurtle/experimental.ulocalized_time" }, "release_url": "https://pypi.org/project/experimental.ulocalized_time/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Experimental version for ulocalized_time Plone function, that extends the date/time formats", "version": "0.1.0" }, "last_serial": 1771633, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "43f2c261180eb52838f8faddeded9cb6", "sha256": "b25c9a4986ea69097bab9b3d3ebd78f70a51eb4eb5ece4fc33720824e9fcf9a4" }, "downloads": -1, "filename": "experimental.ulocalized_time-0.1.0.tar.gz", "has_sig": false, "md5_digest": "43f2c261180eb52838f8faddeded9cb6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13096, "upload_time": "2011-07-21T11:09:23", "url": "https://files.pythonhosted.org/packages/cb/0a/edf4a8689e83ddbfdc3347259e532216cbdb6262e3ff2a60adabbb1fc124/experimental.ulocalized_time-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "43f2c261180eb52838f8faddeded9cb6", "sha256": "b25c9a4986ea69097bab9b3d3ebd78f70a51eb4eb5ece4fc33720824e9fcf9a4" }, "downloads": -1, "filename": "experimental.ulocalized_time-0.1.0.tar.gz", "has_sig": false, "md5_digest": "43f2c261180eb52838f8faddeded9cb6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13096, "upload_time": "2011-07-21T11:09:23", "url": "https://files.pythonhosted.org/packages/cb/0a/edf4a8689e83ddbfdc3347259e532216cbdb6262e3ff2a60adabbb1fc124/experimental.ulocalized_time-0.1.0.tar.gz" } ] }