zc.i18n-0.7.0/0000755000076400007640000000000011232253106013143 5ustar srichtersrichterzc.i18n-0.7.0/ZopePublicLicense.txt0000644000076400007640000000420311221077624017271 0ustar srichtersrichterZope Public License (ZPL) Version 2.1 ------------------------------------- A copyright notice accompanies this license document that identifies the copyright holders. This license has been certified as open source. It has also been designated as GPL compatible by the Free Software Foundation (FSF). Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions in source code must retain the accompanying copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the accompanying copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Names of the copyright holders must not be used to endorse or promote products derived from this software without prior written permission from the copyright holders. 4. The right to distribute this software or to use it for any purpose does not give you the right to use Servicemarks (sm) or Trademarks (tm) of the copyright holders. Use of them is covered by separate agreement with the copyright holders. 5. If any files are modified, you must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. Disclaimer THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. zc.i18n-0.7.0/setup.cfg0000644000076400007640000000007311232253106014764 0ustar srichtersrichter[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 zc.i18n-0.7.0/src/0000755000076400007640000000000011232253106013732 5ustar srichtersrichterzc.i18n-0.7.0/src/zc/0000755000076400007640000000000011232253106014346 5ustar srichtersrichterzc.i18n-0.7.0/src/zc/i18n/0000755000076400007640000000000011232253106015125 5ustar srichtersrichterzc.i18n-0.7.0/src/zc/i18n/duration.txt0000644000076400007640000000377511232253010017521 0ustar srichtersrichter========================= 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' zc.i18n-0.7.0/src/zc/i18n/i18n.py0000644000076400007640000000215711232253010016255 0ustar srichtersrichter############################################################################# # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """I18N support for the i18n helper package. This defines a `MessageFactory` for the I18N domain for the i18n helper package. This is normally used with this import:: from i18n import MessageFactory as _ The factory is then used normally. Two examples:: text = _('some internationalized text') text = _('helpful-descriptive-message-id', 'default text') """ __docformat__ = "reStructuredText" from zope import i18nmessageid MessageFactory = _ = i18nmessageid.MessageFactory("zc.i18n") zc.i18n-0.7.0/src/zc/i18n/locales/0000755000076400007640000000000011232253106016547 5ustar srichtersrichterzc.i18n-0.7.0/src/zc/i18n/locales/zc.i18n.pot0000644000076400007640000000340511232253010020461 0ustar srichtersrichter############################################################################## # # Copyright (c) 2003-2004 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## msgid "" msgstr "" "Project-Id-Version: Development/Revision: 88775/Branch: 3.4\n" "POT-Creation-Date: Sun Aug 10 14:40:23 2008\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Zope 3 Developers \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: zope/app/locales/extract.py\n" #: lib/python/zc/i18n/duration.py:17 msgid "${number} day ${additional}" msgstr "" #: lib/python/zc/i18n/duration.py:18 msgid "${number} days ${additional}" msgstr "" #: lib/python/zc/i18n/duration.py:20 msgid "${number} hour ${additional}" msgstr "" #: lib/python/zc/i18n/duration.py:21 msgid "${number} hours ${additional}" msgstr "" #: lib/python/zc/i18n/duration.py:23 msgid "${number} minute ${additional}" msgstr "" #: lib/python/zc/i18n/duration.py:24 msgid "${number} minutes ${additional}" msgstr "" #: lib/python/zc/i18n/duration.py:26 msgid "${number} second" msgstr "" #: lib/python/zc/i18n/duration.py:27 msgid "${number} seconds" msgstr "" #: lib/python/zc/i18n/duration.py:29 msgid "No time" msgstr "" zc.i18n-0.7.0/src/zc/i18n/locales/README.txt0000644000076400007640000000025011232253010020234 0ustar srichtersrichterSoftware translation files ========================== This directory contains translation files for translating the software strings for the zc.i18n package software. zc.i18n-0.7.0/src/zc/i18n/locales/de/0000755000076400007640000000000011232253106017137 5ustar srichtersrichterzc.i18n-0.7.0/src/zc/i18n/locales/de/LC_MESSAGES/0000755000076400007640000000000011232253106020724 5ustar srichtersrichterzc.i18n-0.7.0/src/zc/i18n/locales/de/LC_MESSAGES/zc.i18n.po0000644000076400007640000000375511232253010022462 0ustar srichtersrichter############################################################################## # # Copyright (c) 2003-2004 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## msgid "" msgstr "" "Project-Id-Version: Development/Revision: 88775/Branch: 3.4\n" "POT-Creation-Date: Sun Aug 10 14:19:52 2008\n" "PO-Revision-Date: 2008-08-10 15:39+0100\n" "Last-Translator: Markus Leist \n" "Language-Team: Zope 3 Developers \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: zope/app/locales/extract.py\n" #: lib/python/zc/i18n/duration.py:17 msgid "${number} day ${additional}" msgstr "${number} Tag ${additional}" #: lib/python/zc/i18n/duration.py:18 msgid "${number} days ${additional}" msgstr "${number} Tage ${additional}" #: lib/python/zc/i18n/duration.py:20 msgid "${number} hour ${additional}" msgstr "${number} Stunde ${additional}" #: lib/python/zc/i18n/duration.py:21 msgid "${number} hours ${additional}" msgstr "${number} Stunden ${additional}" #: lib/python/zc/i18n/duration.py:23 msgid "${number} minute ${additional}" msgstr "${number} Minute ${additional}" #: lib/python/zc/i18n/duration.py:24 msgid "${number} minutes ${additional}" msgstr "${number} Minuten ${additional}" #: lib/python/zc/i18n/duration.py:26 msgid "${number} second" msgstr "${number} Sekunde" #: lib/python/zc/i18n/duration.py:27 msgid "${number} seconds" msgstr "${number} Sekunden" #: lib/python/zc/i18n/duration.py:29 msgid "No time" msgstr "Keine Zeit" zc.i18n-0.7.0/src/zc/i18n/locales/de/LC_MESSAGES/zc.i18n.mo0000644000076400007640000000206611232253010022451 0ustar srichtersrichterÞ• l ¼ðñ *Ge„¤µÇÏOkˆ§Çæ + ${number} day ${additional}${number} days ${additional}${number} hour ${additional}${number} hours ${additional}${number} minute ${additional}${number} minutes ${additional}${number} second${number} secondsNo timeProject-Id-Version: Development/Revision: 88775/Branch: 3.4 POT-Creation-Date: Sun Aug 10 14:19:52 2008 PO-Revision-Date: 2008-08-10 15:39+0100 Last-Translator: Markus Leist Language-Team: Zope 3 Developers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generated-By: zope/app/locales/extract.py ${number} Tag ${additional}${number} Tage ${additional}${number} Stunde ${additional}${number} Stunden ${additional}${number} Minute ${additional}${number} Minuten ${additional}${number} Sekunde${number} SekundenKeine Zeitzc.i18n-0.7.0/src/zc/i18n/duration.py0000644000076400007640000000666011232253010017326 0ustar srichtersrichter############################################################################# # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## from zope import i18n from zc.i18n.i18n import _ ONE_DAY = _('${number} day ${additional}') MULTIPLE_DAYS = _('${number} days ${additional}') ONE_HOUR = _('${number} hour ${additional}') MULTIPLE_HOURS = _('${number} hours ${additional}') ONE_MINUTE = _('${number} minute ${additional}') MULTIPLE_MINUTES = _('${number} minutes ${additional}') ONE_SECOND = _('${number} second') MULTIPLE_SECONDS = _('${number} seconds') NO_TIME = _('No time') def format(request, duration): # this could be better, and better internationalized, but it is a start. # ICU does # not appear to support internationalizing durations over a day, at least # as found in # http://icu.sourceforge.net/apiref/icu4c/classRuleBasedNumberFormat.html # and related docs. # The approach here is to do what English needs in a reasonably flexible, # way and hope others tell us if we need to do more. if (duration.days > 0 or duration.days < -1 or duration.days == -1 and not duration.seconds): if duration.days > 0 or not duration.seconds: big = duration.days little = duration.seconds // 3600 else: # negative and seconds big = duration.days + 1 seconds = duration.seconds - 86400 abs_seconds = abs(seconds) sign = seconds/abs_seconds little = (abs_seconds // 3600) * sign main = (MULTIPLE_DAYS, ONE_DAY) additional = (MULTIPLE_HOURS, ONE_HOUR) elif duration.days or duration.seconds: if duration.days == -1: seconds = duration.seconds - 86400 else: seconds = duration.seconds abs_seconds = abs(seconds) sign = seconds/abs_seconds if abs_seconds // 3600: big = (abs_seconds // 3600) * sign little = ((abs_seconds % 3600) // 60) * sign main = (MULTIPLE_HOURS, ONE_HOUR) additional = (MULTIPLE_MINUTES, ONE_MINUTE) elif abs_seconds // 60: big = (abs_seconds // 60) * sign little = (abs_seconds % 60) * sign main = (MULTIPLE_MINUTES, ONE_MINUTE) additional = (MULTIPLE_SECONDS, ONE_SECOND) else: big = seconds little = None main = (MULTIPLE_SECONDS, ONE_SECOND) else: return i18n.translate(NO_TIME, context=request) if little: message = additional[abs(little)==1] additional = i18n.translate( i18n.Message( message, mapping={'number': str(little), 'additional': ''}), context=request) else: additional = '' message = main[abs(big)==1] return i18n.translate( i18n.Message( message, mapping={'number': str(big), 'additional': additional}), context=request) zc.i18n-0.7.0/src/zc/i18n/date.py0000644000076400007640000000631211232253023016414 0ustar srichtersrichter############################################################################# # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """ $Id: date.py 2041 2005-06-16 18:34:44Z fred $ """ import datetime import pytz from zope.interface.common.idatetime import ITZInfo def now(request): return datetime.datetime.now(ITZInfo(request)) def format(request, dt=None): if dt is None: dt = now(request) formatter = request.locale.dates.getFormatter( 'dateTime', 'medium') return formatter.format(dt) def normalize(request, dt): """this method normalizes datetime instances by converting them to utc, daylight saving times are also taken into account. This method requires an adapter to get the tzinfo from the request. >>> from zope import component, interface >>> import pytz >>> from zope.interface.common.idatetime import ITZInfo >>> from zope.publisher.interfaces.browser import IBrowserRequest >>> from zope.publisher.browser import TestRequest >>> requestTZ = pytz.timezone('Europe/Vienna') >>> @interface.implementer(ITZInfo) ... @component.adapter(IBrowserRequest) ... def tzinfo(request): ... return requestTZ >>> component.provideAdapter(tzinfo) >>> dt = datetime.datetime(2006,5,1,12) >>> request = TestRequest() The Vienna timezone has a 2 hour offset to utc at this date. >>> normalize(request,dt) datetime.datetime(2006, 5, 1, 10, 0, tzinfo=) At this date the timezone has only a one hour offset. >>> dt = datetime.datetime(2006,2,1,12) >>> normalize(request,dt) datetime.datetime(2006, 2, 1, 11, 0, tzinfo=) Normalizing UTC to UTC should work also >>> dt = datetime.datetime(2006,5,1,12,tzinfo=pytz.UTC) >>> normalize(request,dt) datetime.datetime(2006, 5, 1, 12, 0, tzinfo=) This way too UTC to UTC >>> requestTZ = pytz.UTC >>> dt = datetime.datetime(2006,5,1,12) >>> normalize(request,dt) datetime.datetime(2006, 5, 1, 12, 0, tzinfo=) Just so you would know that these are possible - The time that does not exist (defaulting to is_dst=False will raise an index error in this case): >>> requestTZ = pytz.timezone('Europe/Vilnius') >>> dt = datetime.datetime(2006,3,26,3,30) >>> normalize(request,dt) Traceback (most recent call last): ... NonExistentTimeError: 2006-03-26 03:30:00 An ambiguous time: >>> dt = datetime.datetime(2006,10,29,3,30) >>> normalize(request,dt) Traceback (most recent call last): ... AmbiguousTimeError: 2006-10-29 03:30:00 """ if dt.tzinfo is None: tzinfo = ITZInfo(request) dt = tzinfo.localize(dt, is_dst=None) return dt.astimezone(pytz.utc) zc.i18n-0.7.0/src/zc/i18n/tests.py0000644000076400007640000000161611232253010016637 0ustar srichtersrichter############################################################################# # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## import unittest from zope.testing import doctest def test_suite(): return unittest.TestSuite(( doctest.DocFileSuite('duration.txt'), doctest.DocTestSuite('zc.i18n.date') )) if __name__ == '__main__': unittest.main(defaultTest='test_suite') zc.i18n-0.7.0/src/zc/i18n/configure.zcml0000644000076400007640000000031311232253010017764 0ustar srichtersrichter zc.i18n-0.7.0/src/zc/i18n/__init__.py0000644000076400007640000000000211232253010017220 0ustar srichtersrichter# zc.i18n-0.7.0/src/zc/__init__.py0000644000076400007640000000031011232253010016443 0ustar srichtersrichter# this is a namespace package try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) zc.i18n-0.7.0/src/zc.i18n.egg-info/0000755000076400007640000000000011232253106016616 5ustar srichtersrichterzc.i18n-0.7.0/src/zc.i18n.egg-info/SOURCES.txt0000644000076400007640000000123211232253106020500 0ustar srichtersrichterCHANGES.txt README.txt ZopePublicLicense.txt bootstrap.py buildout.cfg setup.py src/zc/__init__.py src/zc.i18n.egg-info/PKG-INFO src/zc.i18n.egg-info/SOURCES.txt src/zc.i18n.egg-info/dependency_links.txt src/zc.i18n.egg-info/namespace_packages.txt src/zc.i18n.egg-info/not-zip-safe src/zc.i18n.egg-info/requires.txt src/zc.i18n.egg-info/top_level.txt src/zc/i18n/__init__.py src/zc/i18n/configure.zcml src/zc/i18n/date.py src/zc/i18n/duration.py src/zc/i18n/duration.txt src/zc/i18n/i18n.py src/zc/i18n/tests.py src/zc/i18n/locales/README.txt src/zc/i18n/locales/zc.i18n.pot src/zc/i18n/locales/de/LC_MESSAGES/zc.i18n.mo src/zc/i18n/locales/de/LC_MESSAGES/zc.i18n.pozc.i18n-0.7.0/src/zc.i18n.egg-info/namespace_packages.txt0000644000076400007640000000000311232253106023142 0ustar srichtersrichterzc zc.i18n-0.7.0/src/zc.i18n.egg-info/PKG-INFO0000644000076400007640000000777311232253106017731 0ustar srichtersrichterMetadata-Version: 1.0 Name: zc.i18n Version: 0.7.0 Summary: Additional I18n Support APIs Home-page: http://cheeseshop.python.org/pypi/zc.i18n Author: Zope Corporation and Contributors Author-email: zope3-dev@zope.org License: ZPL 2.1 Description: 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. 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. Keywords: zope3 i18n date time duration Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zc.i18n-0.7.0/src/zc.i18n.egg-info/requires.txt0000644000076400007640000000013211232253106021212 0ustar srichtersrichtersetuptools zope.i18n zope.i18nmessageid zope.interface [test] zope.testing zope.publisherzc.i18n-0.7.0/src/zc.i18n.egg-info/top_level.txt0000644000076400007640000000000311232253106021341 0ustar srichtersrichterzc zc.i18n-0.7.0/src/zc.i18n.egg-info/dependency_links.txt0000644000076400007640000000000111232253106022664 0ustar srichtersrichter zc.i18n-0.7.0/src/zc.i18n.egg-info/not-zip-safe0000644000076400007640000000000111232253031021041 0ustar srichtersrichter zc.i18n-0.7.0/setup.py0000644000076400007640000000433111232252550014660 0ustar srichtersrichter############################################################################## # # Copyright (c) 2007 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Setup for z3c.viewlet package $Id: setup.py 81038 2007-10-24 14:34:17Z srichter $ """ import os from setuptools import setup, find_packages def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() setup( name='zc.i18n', version = '0.7.0', author='Zope Corporation and Contributors', author_email='zope3-dev@zope.org', description='Additional I18n Support APIs', long_description=( read('README.txt') + '\n\n' + 'Detailed Dcoumentation\n' + '======================\n' + '\n\n' + read('src', 'zc', 'i18n', 'duration.txt') + '\n\n' + read('CHANGES.txt') ), keywords = "zope3 i18n date time duration", classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: Zope Public License', 'Programming Language :: Python', 'Natural Language :: English', 'Operating System :: OS Independent', 'Topic :: Internet :: WWW/HTTP', 'Framework :: Zope3'], url='http://cheeseshop.python.org/pypi/zc.i18n', license='ZPL 2.1', packages=find_packages('src'), package_dir = {'': 'src'}, namespace_packages=['zc'], extras_require=dict( test=['zope.testing', 'zope.publisher', ]), install_requires=[ 'setuptools', 'zope.i18n', 'zope.i18nmessageid', 'zope.interface', ], include_package_data = True, zip_safe = False, ) zc.i18n-0.7.0/buildout.cfg0000644000076400007640000000014011232251340015444 0ustar srichtersrichter[buildout] develop = . parts = test [test] recipe = zc.recipe.testrunner eggs = zc.i18n [test] zc.i18n-0.7.0/PKG-INFO0000644000076400007640000000777311232253106014256 0ustar srichtersrichterMetadata-Version: 1.0 Name: zc.i18n Version: 0.7.0 Summary: Additional I18n Support APIs Home-page: http://cheeseshop.python.org/pypi/zc.i18n Author: Zope Corporation and Contributors Author-email: zope3-dev@zope.org License: ZPL 2.1 Description: 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. 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. Keywords: zope3 i18n date time duration Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zc.i18n-0.7.0/bootstrap.py0000644000076400007640000000337411221077624015550 0ustar srichtersrichter############################################################################## # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Bootstrap a buildout-based project Simply run this script in a directory containing a buildout.cfg. The script accepts buildout command-line options, so you can use the -c option to specify an alternate configuration file. $Id: bootstrap.py 81428 2007-11-03 06:22:18Z srichter $ """ import os, shutil, sys, tempfile, urllib2 tmpeggs = tempfile.mkdtemp() ez = {} exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py' ).read() in ez ez['use_setuptools'](to_dir=tmpeggs, download_delay=0) import pkg_resources cmd = 'from setuptools.command.easy_install import main; main()' if sys.platform == 'win32': cmd = '"%s"' % cmd # work around spawn lamosity on windows ws = pkg_resources.working_set assert os.spawnle( os.P_WAIT, sys.executable, sys.executable, '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout', dict(os.environ, PYTHONPATH= ws.find(pkg_resources.Requirement.parse('setuptools')).location ), ) == 0 ws.add_entry(tmpeggs) ws.require('zc.buildout') import zc.buildout.buildout zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap']) shutil.rmtree(tmpeggs) zc.i18n-0.7.0/README.txt0000644000076400007640000000022111221077624014643 0ustar srichtersrichterThis package provides additional I18n and L10n features. In particular it provides an API to compute the time duratrions over various timezones. zc.i18n-0.7.0/CHANGES.txt0000644000076400007640000000104411232252716014761 0ustar srichtersrichter======= 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. 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.