Incompatibilities with recent CLDR releases

Bug #1073940 reported by Murithi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.i18n
Won't Fix
Undecided
Unassigned

Bug Description

The versions of LDML files in locales/data are pretty old (released in 2004).
Getting any new version from unicode.org: http://unicode.org/repos/cldr/trunk/common/main/ reveals a number of issues:

1. Parsing the generation in this format fails:
<generation date="$Date: 2012-10-11 23:11:48 +0300 (Thu, 11 Oct 2012) $"/>

  File ".../eggs/zope.i18n-3.7.4-py2.7.egg/zope/i18n/locales/xmlfactory.py", line 79, in _extractVersion
    generationDate = date(int(year), int(month), int(day))
ValueError: invalid literal for int() with base 10: '$Date: 2012'

2. There is an assumption that a date format e.g.:
      <dateFormat>
       <pattern>MMMM d, y</pattern>
      </dateFormat>
implies length for all the date parts - it does not and will fail when formatting dates.

  File ".../eggs/zope.i18n-3.7.4-py2.7.egg/zope/i18n/format.py", line 192, in format
    text += info.get(elem, elem)
TypeError: coercing to Unicode: need string or buffer, tuple found
<type 'exceptions.TypeError'>:
coercing to Unicode: need string or buffer, tuple found
> /home/undesa/bungeni_apps/bungeni/eggs/zope.i18n-3.7.4-py2.7.egg/zope/i18n/format.py(192)format()
-> text += info.get(elem, elem)

This likely never bombed before since a lookup of the info dictionary always returned a string.

3. getFormatter (zope/i18n/locales/__init__.py LINE 495)
There are a number of issues with lookup here:

        formats = getattr(cal, category+'Formats')
        if length is None:
            length = getattr(
                cal,
                'default'+category[0].upper()+category[1:]+'Format',
                formats.keys()[0])

        # 'datetime' is always a bit special; we often do not have a length
        # specification, but we need it for looking up the date and time
        # formatters
        if category == 'dateTime':
            formatLength = formats.get(length, formats[None])

For instance: length = getattr(cal, 'default'+category[0].upper()+category[1:]+'Format', formats.keys()[0])
Why should this fall back to looking up the format key from the calendar instance?
Also, formats[None] raises an AttributeError

Revision history for this message
Tres Seaver (tseaver) wrote :
Changed in zope.i18n:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.