Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install experimental.ulocalized-time

How to install experimental.ulocalized_time

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install experimental.ulocalized-time
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1.0 Available View build log
Windows (64-bit)
0.1.0 Available View build log
Mac OS X (10.5+)
0.1.0 Available View build log
Linux (32-bit)
0.1.0 Available View build log
Linux (64-bit)
0.1.0 Available View build log
Lastest release
version 0.1.0 on Jul 22nd, 2011


This product can be used by people that want to use an strftime compatible format for display locale sensible data inside Plone templates.

The Python Way

Python support locales through the locale module but this seems not working properly inside Plone, for example the setlocale function says:

setlocale() is not thread-safe on most systems. Applications typically start with a call of

>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')

This sets the locale for all categories to the user’s default setting (typically specified in the LANG environment variable). If the locale is not changed thereafter, using multithreading should not cause problems.

So it seems that you can force a locale (or use the system ones) but I fear this is not a good idea for Plone sites that need to be used in more than a language. Plone itself don't use the Python locales for translate dates elements.

The Plone Way

Inside Plone you can print date in a full working i18n aware way using the toLocalizedTime method of the ploneview. However you can simply use a couple of format: long_format or short_format, defined in the Plone localization product, passing True or False as second parameter:

>>> from DateTime import DateTime
>>> t = DateTime()
>>> ploneview.toLocalizedTime(t, True)


Installing this product will give you an alternative, patching Plone. You can continue using toLocalizedTime but you can play with the long_format parameter, that in fact became also a format parameter.

You can still use the method as above (so basic Plone features are not touched) but you can provide a long_format value that can be a format string.

For example, a valid Python date string format as "%a %d hello guys %b %Y" became "${a} ${d} hello guys ${b} ${Y}", so:

>>> from DateTime import DateTime
>>> t = DateTime()
>>> ploneview.toLocalizedTime(t, "${a} ${d} hello guys ${b} ${Y}")

Maybe this product is wrong and there is a way to make strftime working properly in a Plone multi-language site, but I don't find any information about an alternative way! If you know how to do this, please contribute to the discussion and help me deprecate this add-on!


This product was developed by RedTurtle Technology team.

RedTurtle Technology Site


0.1.0 (2011-07-21)
  • Initial release

Subscribe to package updates

Last updated Jul 22nd, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.