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.

Download
ActivePython
INSTALL>
pypm install zc.i18n

How to install zc.i18n

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install zc.i18n
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.7.0 Available View build log
Windows (64-bit)
0.7.0 Available View build log
Mac OS X (10.5+)
0.7.0 Available View build log
Linux (32-bit)
0.7.0 Available View build log
Linux (64-bit)
0.7.0 Available View build log
 
License
ZPL 2.1
Imports
Lastest release
version 0.7.0 on Jan 5th, 2011

This package provides additional I18n and L10n features. In particular it provides an API to compute the time duratrions over various timezones.

Detailed Dcoumentation

Time Duration Computation

The duration format code is not ideal, but as the code notes, the icu library does not appear to support internationalizing dates. Therefore, this approach tries to get close enough to be flexible enough for most localization. Only time, and localizers, will tell if it is a reasonable approach.

The formatter always gives the first two pertinent measures of a duration, leaving off the rest. The rest of the file just shows some examples.

>>> from zc.i18n.duration import format
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> from datetime import timedelta
>>> format(request, timedelta(days=5))
u'5 days '
>>> format(request, timedelta(days=1))
u'1 day '
>>> format(request, timedelta(days=1, hours=13, minutes=12))
u'1 day 13 hours '
>>> format(request, timedelta(hours=13, minutes=12))
u'13 hours 12 minutes '
>>> format(request, timedelta(hours=13))
u'13 hours '
>>> format(request, timedelta(hours=1, minutes=1, seconds=1))
u'1 hour 1 minute '
>>> format(request, timedelta(minutes=45, seconds=1))
u'45 minutes 1 second'
>>> format(request, timedelta(seconds=5))
u'5 seconds'
>>> format(request, timedelta(days=-1, hours=-2))
u'-1 day -2 hours '
>>> format(request, timedelta(days=-2, hours=22))
u'-1 day -2 hours '
>>> format(request, timedelta(days=-1))
u'-1 day '
>>> format(request, timedelta(days=-1, hours=-13, minutes=-12))
u'-1 day -13 hours '
>>> format(request, timedelta(hours=-13, minutes=-12))
u'-13 hours -12 minutes '
>>> format(request, timedelta(hours=-13))
u'-13 hours '
>>> format(request, timedelta(hours=-1, minutes=-1, seconds=-1))
u'-1 hour -1 minute '
>>> format(request, timedelta(minutes=-45, seconds=-1))
u'-45 minutes -1 second'
>>> format(request, timedelta(seconds=-5))
u'-5 seconds'
>>> format(request, timedelta())
u'No time'
CHANGES
0.7.0 (2009-07-24)
  • Fixed tests to work with latest package versions.
  • The buildout now also pulls in the test extras, which is required.
0.6.1 (2008-05-20)
  • No code changes, and only a very minor documentation tweak.

System Message: WARNING/2 (<string>, line 79)

Bullet list ends without a blank line; unexpected unindent.

Re-released to avoid confusion over package versions found in the wild.

0.5.2 (2007-11-03)
  • Improve package data.
0.5.1 (2006-05-24)
  • Package data update.
0.5.0 (2006-05-24)
  • Initial release.

Subscribe to package updates

Last updated Jan 5th, 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.