zope.i18n 5.0__py3-none-any.whl → 5.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. zope/i18n/format.py +2 -1
  2. zope/i18n/gettextmessagecatalog.py +2 -2
  3. zope/i18n/locales/__init__.py +23 -23
  4. zope/i18n/locales/fallbackcollator.txt +3 -3
  5. zope/i18n/locales/tests/test_docstrings.py +3 -4
  6. zope/i18n/locales/tests/test_fallbackcollator.py +1 -7
  7. zope/i18n/locales/xmlfactory.py +123 -123
  8. zope/i18n/testing.py +11 -12
  9. zope/i18n/testmessagecatalog.py +2 -2
  10. zope/i18n/tests/locale/de/LC_MESSAGES/zope-i18n.mo +0 -0
  11. zope/i18n/tests/locale/en/LC_MESSAGES/zope-i18n.mo +0 -0
  12. zope/i18n/tests/locale-alt/en/LC_MESSAGES/alt.mo +0 -0
  13. zope/i18n/tests/locale-default/de/LC_MESSAGES/default.mo +0 -0
  14. zope/i18n/tests/locale-default/en/LC_MESSAGES/default.mo +0 -0
  15. zope/i18n/tests/locale-default/pl/LC_MESSAGES/default.mo +0 -0
  16. zope/i18n/tests/locale-default/sr/LC_MESSAGES/default.mo +0 -0
  17. zope/i18n/tests/locale-default/sr@Cyrl/LC_MESSAGES/default.mo +0 -0
  18. zope/i18n/tests/locale-default/sr@Latn/LC_MESSAGES/default.mo +0 -0
  19. zope/i18n/tests/locale2/en/LC_MESSAGES/zope-i18n.mo +0 -0
  20. zope/i18n/tests/locale3/en/LC_MESSAGES/zope-i18n.mo +0 -0
  21. zope/i18n/tests/locale3/en/LC_MESSAGES/zope-i18n2.mo +0 -0
  22. zope/i18n/tests/test.py +1 -4
  23. zope/i18n/tests/test_formats.py +603 -714
  24. zope/i18n/tests/test_gettextmessagecatalog.py +4 -1
  25. zope/i18n/tests/test_plurals.py +7 -2
  26. zope/i18n/tests/test_translationdomain.py +37 -19
  27. {zope.i18n-5.0.dist-info → zope.i18n-5.2.dist-info}/METADATA +21 -4
  28. {zope.i18n-5.0.dist-info → zope.i18n-5.2.dist-info}/RECORD +40 -28
  29. {zope.i18n-5.0.dist-info → zope.i18n-5.2.dist-info}/WHEEL +1 -1
  30. /zope/i18n/tests/{en-alt.po → locale-alt/en/LC_MESSAGES/alt.po} +0 -0
  31. /zope/i18n/tests/{de-default.po → locale-default/de/LC_MESSAGES/default.po} +0 -0
  32. /zope/i18n/tests/{en-default.po → locale-default/en/LC_MESSAGES/default.po} +0 -0
  33. /zope/i18n/tests/{pl-default.po → locale-default/pl/LC_MESSAGES/default.po} +0 -0
  34. /zope/i18n/tests/{sr-default.po → locale-default/sr/LC_MESSAGES/default.po} +0 -0
  35. /zope/i18n/tests/{sr@Cyrl-default.po → locale-default/sr@Cyrl/LC_MESSAGES/default.po} +0 -0
  36. /zope/i18n/tests/{sr@Latn-default.po → locale-default/sr@Latn/LC_MESSAGES/default.po} +0 -0
  37. /zope.i18n-5.0-py3.9-nspkg.pth → /zope.i18n-5.2-py3.11-nspkg.pth +0 -0
  38. {zope.i18n-5.0.dist-info → zope.i18n-5.2.dist-info}/LICENSE.txt +0 -0
  39. {zope.i18n-5.0.dist-info → zope.i18n-5.2.dist-info}/namespace_packages.txt +0 -0
  40. {zope.i18n-5.0.dist-info → zope.i18n-5.2.dist-info}/top_level.txt +0 -0
zope/i18n/format.py CHANGED
@@ -23,6 +23,7 @@ import sys
23
23
 
24
24
  import pytz
25
25
  import pytz.reference
26
+
26
27
  from zope.interface import implementer
27
28
 
28
29
  from zope.i18n.interfaces import IDateTimeFormat
@@ -611,7 +612,7 @@ def buildDateTimeParseInfo(calendar, pattern):
611
612
 
612
613
  # am/pm marker (Text)
613
614
  for entry in _findFormattingCharacterInPattern('a', pattern):
614
- info[entry] = r'({}|{})'.format(calendar.am, calendar.pm)
615
+ info[entry] = fr'({calendar.am}|{calendar.pm})'
615
616
 
616
617
  # era designator (Text)
617
618
  # TODO: works for gregorian only right now
@@ -35,11 +35,11 @@ class _KeyErrorRaisingFallback:
35
35
 
36
36
  def plural_formatting(func):
37
37
  """This decorator interpolates the possible formatting marker.
38
- This interpolation marker is usally present for plurals.
38
+ This interpolation marker is usually present for plurals.
39
39
  Example: `There are %d apples` or `They have %s pies.`
40
40
 
41
41
  Please note that the interpolation can be done, alternatively,
42
- using the mapping. This is only present as a conveniance.
42
+ using the mapping. This is only present as a convenience.
43
43
  """
44
44
  @wraps(func)
45
45
  def pformat(catalog, singular, plural, n, *args, **kwargs):
@@ -187,14 +187,14 @@ class LocaleDisplayNames(AttributeInheritance):
187
187
 
188
188
  >>> locale = LocaleInheritanceStub(nextLocale=root)
189
189
  >>> locale.displayNames = LocaleDisplayNames()
190
- >>> locale.displayNames.keys = ['fu', 'bahr']
190
+ >>> locale.displayNames.keys = ['f', 'bahr']
191
191
 
192
192
  Here you can see the inheritance in action::
193
193
 
194
194
  >>> locale.displayNames.languages
195
195
  ['en', 'de']
196
196
  >>> locale.displayNames.keys
197
- ['fu', 'bahr']
197
+ ['f', 'bahr']
198
198
  """
199
199
 
200
200
 
@@ -297,13 +297,13 @@ class LocaleCalendar(AttributeInheritance):
297
297
  >>> locale.calendar.months = InheritingDictionary(
298
298
  ... {2: (u"Februar", u"Feb"), 3: (u"Maerz", u"Mrz")})
299
299
  >>> locale.calendar.getMonthNames()[:4]
300
- [u'January', u'Februar', u'Maerz', None]
300
+ ['January', 'Februar', 'Maerz', None]
301
301
  >>> locale.calendar.getMonthTypeFromName(u"January")
302
302
  1
303
303
  >>> locale.calendar.getMonthTypeFromName(u"Februar")
304
304
  2
305
305
  >>> locale.calendar.getMonthAbbreviations()[:4]
306
- [u'Jan', u'Feb', u'Mrz', None]
306
+ ['Jan', 'Feb', 'Mrz', None]
307
307
  >>> locale.calendar.getMonthTypeFromAbbreviation(u"Jan")
308
308
  1
309
309
  >>> locale.calendar.getMonthTypeFromAbbreviation(u"Mrz")
@@ -314,13 +314,13 @@ class LocaleCalendar(AttributeInheritance):
314
314
  >>> locale.calendar.days = InheritingDictionary(
315
315
  ... {2: (u"Dienstag", u"Die"), 3: (u"Mittwoch", u"Mit")})
316
316
  >>> locale.calendar.getDayNames()[:4]
317
- [u'Monday', u'Dienstag', u'Mittwoch', None]
317
+ ['Monday', 'Dienstag', 'Mittwoch', None]
318
318
  >>> locale.calendar.getDayTypeFromName(u"Monday")
319
319
  1
320
320
  >>> locale.calendar.getDayTypeFromName(u"Dienstag")
321
321
  2
322
322
  >>> locale.calendar.getDayAbbreviations()[:4]
323
- [u'Mon', u'Die', u'Mit', None]
323
+ ['Mon', 'Die', 'Mit', None]
324
324
  >>> locale.calendar.getDayTypeFromAbbreviation(u"Mon")
325
325
  1
326
326
  >>> locale.calendar.getDayTypeFromAbbreviation(u"Die")
@@ -328,7 +328,7 @@ class LocaleCalendar(AttributeInheritance):
328
328
 
329
329
  >>> root.calendar.week = {'firstDay': 1}
330
330
  >>> locale.calendar.getFirstWeekDayName()
331
- u'Monday'
331
+ 'Monday'
332
332
 
333
333
  Let's test the direct attribute access as well.
334
334
 
@@ -336,9 +336,9 @@ class LocaleCalendar(AttributeInheritance):
336
336
  >>> root.pm = u"PM"
337
337
  >>> locale.pm = u"nachm."
338
338
  >>> locale.pm
339
- u'nachm.'
339
+ 'nachm.'
340
340
  >>> locale.am
341
- u'AM'
341
+ 'AM'
342
342
 
343
343
  Note that ``isWeekend`` is not implemented:
344
344
 
@@ -444,11 +444,11 @@ class LocaleDates(AttributeInheritance):
444
444
 
445
445
  >>> formatter = dates.getFormatter('date')
446
446
  >>> formatter.format(date(2004, 2, 4))
447
- u'04.02.2004'
447
+ '04.02.2004'
448
448
 
449
449
  >>> formatter = dates.getFormatter('date', length='full')
450
450
  >>> formatter.format(date(2004, 2, 4))
451
- u'Mittwoch, 4. Februar 2004'
451
+ 'Mittwoch, 4. Februar 2004'
452
452
 
453
453
  Let's also test the time formatter::
454
454
 
@@ -467,11 +467,11 @@ class LocaleDates(AttributeInheritance):
467
467
 
468
468
  >>> formatter = dates.getFormatter('time')
469
469
  >>> formatter.format(time(12, 15, 00))
470
- u'12:15:00'
470
+ '12:15:00'
471
471
 
472
472
  >>> formatter = dates.getFormatter('time', length='full')
473
473
  >>> formatter.format(time(12, 15, 00))
474
- u'12:15 Uhr +000'
474
+ '12:15 Uhr +000'
475
475
 
476
476
  The datetime formatter is a bit special, since it is constructed from
477
477
  the other two::
@@ -484,11 +484,11 @@ class LocaleDates(AttributeInheritance):
484
484
 
485
485
  >>> formatter = dates.getFormatter('dateTime')
486
486
  >>> formatter.format(datetime(2004, 2, 4, 12, 15, 00))
487
- u'04.02.2004 12:15:00'
487
+ '04.02.2004 12:15:00'
488
488
 
489
489
  >>> formatter = dates.getFormatter('dateTime', length='full')
490
490
  >>> formatter.format(datetime(2004, 2, 4, 12, 15, 00))
491
- u'Mittwoch, 4. Februar 2004 12:15 Uhr +000'
491
+ 'Mittwoch, 4. Februar 2004 12:15 Uhr +000'
492
492
 
493
493
  Finally, we'll test some invalid input::
494
494
 
@@ -588,11 +588,11 @@ class LocaleNumbers(AttributeInheritance):
588
588
  >>> numbers.decimalFormats = {None: length}
589
589
  >>> formatter = numbers.getFormatter('decimal')
590
590
  >>> formatter.format(3.4)
591
- u'3,4'
591
+ '3,4'
592
592
  >>> formatter.format(-3.4567)
593
- u'-3,457'
593
+ '-3,457'
594
594
  >>> formatter.format(3210.4)
595
- u'3.210,4'
595
+ '3.210,4'
596
596
 
597
597
  Setting up and accessing scientific formats with named format lengths::
598
598
 
@@ -609,10 +609,10 @@ class LocaleNumbers(AttributeInheritance):
609
609
  >>> numbers.defaultScientificFormat = 'long'
610
610
  >>> formatter = numbers.getFormatter('scientific')
611
611
  >>> formatter.format(1234.5678)
612
- u'1,234568E+03'
612
+ '1,234568E+03'
613
613
  >>> formatter = numbers.getFormatter('scientific', 'medium')
614
614
  >>> formatter.format(1234.5678)
615
- u'1,2346E+03'
615
+ '1,2346E+03'
616
616
 
617
617
  Setting up and accessing percent formats with named format lengths
618
618
  and format names::
@@ -627,17 +627,17 @@ class LocaleNumbers(AttributeInheritance):
627
627
  >>> numbers.defaultPercentFormat = 'long'
628
628
  >>> formatter = numbers.getFormatter('percent')
629
629
  >>> formatter.format(123.45678)
630
- u'123,457%'
630
+ '123,457%'
631
631
  >>> formatter = numbers.getFormatter('percent', name='bar')
632
632
  >>> formatter.format(123.45678)
633
- u'123%'
633
+ '123%'
634
634
 
635
635
  ...using a default name::
636
636
 
637
637
  >>> numbers.percentFormats['long'].default = 'bar'
638
638
  >>> formatter = numbers.getFormatter('percent')
639
639
  >>> formatter.format(123.45678)
640
- u'123%'
640
+ '123%'
641
641
 
642
642
  """
643
643
 
@@ -33,7 +33,7 @@ strings in a slightly friendly way:
33
33
 
34
34
  >>> sorted([u"Sam", u"sally", u"Abe", u"alice", u"Terry", u"tim"],
35
35
  ... key=collator.key)
36
- [u'Abe', u'alice', u'sally', u'Sam', u'Terry', u'tim']
36
+ ['Abe', 'alice', 'sally', 'Sam', 'Terry', 'tim']
37
37
 
38
38
 
39
39
  The collator has a very simple algorithm. It normalizes strings and
@@ -42,10 +42,10 @@ string and the normalized string. We can see this by calling the key
42
42
  method, which converts unicode strings to collation keys:
43
43
 
44
44
  >>> collator.key(u"Sam")
45
- (u'sam', u'Sam')
45
+ ('sam', 'Sam')
46
46
 
47
47
  >>> collator.key(u"\xc6\xf8a\u030a")
48
- (u'\xe6\xf8\xe5', u'\xc6\xf8\xe5')
48
+ ('æøå', 'Æøå')
49
49
 
50
50
  There is also a cmp function for comparing strings:
51
51
 
@@ -18,7 +18,6 @@ from doctest import DocTestSuite
18
18
 
19
19
  from zope.i18n.locales.inheritance import AttributeInheritance
20
20
  from zope.i18n.locales.inheritance import NoParentException
21
- from zope.i18n.testing import unicode_checker
22
21
 
23
22
 
24
23
  class LocaleInheritanceStub(AttributeInheritance):
@@ -34,7 +33,7 @@ class LocaleInheritanceStub(AttributeInheritance):
34
33
 
35
34
  def test_suite():
36
35
  return unittest.TestSuite((
37
- DocTestSuite('zope.i18n.locales', checker=unicode_checker),
38
- DocTestSuite('zope.i18n.locales.inheritance', checker=unicode_checker),
39
- DocTestSuite('zope.i18n.locales.xmlfactory', checker=unicode_checker),
36
+ DocTestSuite('zope.i18n.locales'),
37
+ DocTestSuite('zope.i18n.locales.inheritance'),
38
+ DocTestSuite('zope.i18n.locales.xmlfactory'),
40
39
  ))
@@ -13,13 +13,7 @@
13
13
  ##############################################################################
14
14
 
15
15
  import doctest
16
- import unittest
17
-
18
- from zope.i18n.testing import unicode_checker
19
16
 
20
17
 
21
18
  def test_suite():
22
- return unittest.TestSuite((
23
- doctest.DocFileSuite('../fallbackcollator.txt',
24
- checker=unicode_checker),
25
- ))
19
+ return doctest.DocFileSuite('../fallbackcollator.txt')