[CalendarServer-changes] [3247] CalendarServer/branches/users/sagen/localization-3218
source_changes at macosforge.org
source_changes at macosforge.org
Tue Oct 28 13:21:38 PDT 2008
Revision: 3247
http://trac.macosforge.org/projects/calendarserver/changeset/3247
Author: sagen at apple.com
Date: 2008-10-28 13:21:38 -0700 (Tue, 28 Oct 2008)
Log Message:
-----------
Added event duration, and unit tests
Modified Paths:
--------------
CalendarServer/branches/users/sagen/localization-3218/locales/en/LC_MESSAGES/calendarserver.po
CalendarServer/branches/users/sagen/localization-3218/locales/fr/LC_MESSAGES/calendarserver.mo
CalendarServer/branches/users/sagen/localization-3218/locales/fr/LC_MESSAGES/calendarserver.po
CalendarServer/branches/users/sagen/localization-3218/locales/pig/LC_MESSAGES/calendarserver.mo
CalendarServer/branches/users/sagen/localization-3218/locales/pig/LC_MESSAGES/calendarserver.po
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/localization.py
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/mail.py
Added Paths:
-----------
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/en/
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/en/LC_MESSAGES/
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/en/LC_MESSAGES/calendarserver.mo
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/en/LC_MESSAGES/calendarserver.po
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/pig/
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/pig/LC_MESSAGES/
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/pig/LC_MESSAGES/calendarserver.mo
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/pig/LC_MESSAGES/calendarserver.po
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/test_localization.py
Modified: CalendarServer/branches/users/sagen/localization-3218/locales/en/LC_MESSAGES/calendarserver.po
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/locales/en/LC_MESSAGES/calendarserver.po 2008-10-28 18:21:44 UTC (rev 3246)
+++ CalendarServer/branches/users/sagen/localization-3218/locales/en/LC_MESSAGES/calendarserver.po 2008-10-28 20:21:38 UTC (rev 3247)
@@ -223,3 +223,30 @@
msgid "Location"
msgstr ""
+msgid "Duration"
+msgstr ""
+
+
+msgid "1 day"
+msgstr
+
+msgid "%(dayCount)d days"
+msgstr
+
+msgid "1 hour"
+
+msgid "%(hourCount)d hours"
+msgstr
+
+msgid "1 minute"
+msgstr
+
+msgid "%(minuteCount)d minutes"
+msgstr
+
+msgid "1 second"
+msgstr
+
+msgid "%(secondCount)d seconds"
+msgstr
+
Modified: CalendarServer/branches/users/sagen/localization-3218/locales/fr/LC_MESSAGES/calendarserver.mo
===================================================================
(Binary files differ)
Modified: CalendarServer/branches/users/sagen/localization-3218/locales/fr/LC_MESSAGES/calendarserver.po
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/locales/fr/LC_MESSAGES/calendarserver.po 2008-10-28 18:21:44 UTC (rev 3246)
+++ CalendarServer/branches/users/sagen/localization-3218/locales/fr/LC_MESSAGES/calendarserver.po 2008-10-28 20:21:38 UTC (rev 3247)
@@ -67,7 +67,11 @@
msgid "Location"
msgstr "Emplacement"
+msgid "Duration"
+msgstr "Durée"
+
+
#: twistedcaldav/localization.py:131
msgid "Monday"
msgstr "Lundi"
@@ -78,7 +82,7 @@
#: twistedcaldav/localization.py:133
msgid "Wednesday"
-msgstr "Mer."
+msgstr "Mercredi"
#: twistedcaldav/localization.py:134
msgid "Thursday"
@@ -130,7 +134,7 @@
#: twistedcaldav/localization.py:153
msgid "February"
-msgstr "Février"
+msgstr "Février"
#: twistedcaldav/localization.py:154
msgid "March"
@@ -154,7 +158,7 @@
#: twistedcaldav/localization.py:159
msgid "August"
-msgstr "Août"
+msgstr "Août"
#: twistedcaldav/localization.py:160
msgid "September"
@@ -170,7 +174,7 @@
#: twistedcaldav/localization.py:163
msgid "December"
-msgstr "Décembre"
+msgstr "Décembre"
#: twistedcaldav/localization.py:168
msgid "Jan"
@@ -216,3 +220,26 @@
msgid "Dec"
msgstr ""
+msgid "1 day"
+msgstr
+
+msgid "%(dayCount)d days"
+msgstr
+
+msgid "1 hour"
+msgstr "1 jour"
+
+msgid "%(hourCount)d hours"
+msgstr "%(hourCount)d jours"
+
+msgid "1 minute"
+msgstr "1 minute"
+
+msgid "%(minuteCount)d minutes"
+msgstr "%(minuteCount)d minutes"
+
+msgid "1 second"
+msgstr "1 seconde"
+
+msgid "%(secondCount)d seconds"
+msgstr "%(secondCount)d secondes"
Modified: CalendarServer/branches/users/sagen/localization-3218/locales/pig/LC_MESSAGES/calendarserver.mo
===================================================================
(Binary files differ)
Modified: CalendarServer/branches/users/sagen/localization-3218/locales/pig/LC_MESSAGES/calendarserver.po
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/locales/pig/LC_MESSAGES/calendarserver.po 2008-10-28 18:21:44 UTC (rev 3246)
+++ CalendarServer/branches/users/sagen/localization-3218/locales/pig/LC_MESSAGES/calendarserver.po 2008-10-28 20:21:38 UTC (rev 3247)
@@ -223,3 +223,30 @@
msgid "Location"
msgstr "Ocationlay"
+msgid "Duration"
+msgstr "Urationday"
+
+msgid "1 day"
+msgstr "1 ayday"
+
+msgid "%(dayCount)d days"
+msgstr "%(dayCount)d aysday"
+
+msgid "1 hour"
+msgstr "1 ourhay"
+
+msgid "%(hourCount)d hours"
+msgstr "%(hourCount)d ourshay"
+
+msgid "1 minute"
+msgstr "1 inutemay"
+
+msgid "%(minuteCount)d minutes"
+msgstr "%(minuteCount)d inutesmay"
+
+msgid "1 second"
+msgstr "1 econdsay"
+
+msgid "%(secondCount)d seconds"
+msgstr "%(secondCount)d econdsay"
+
Modified: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/localization.py
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/localization.py 2008-10-28 18:21:44 UTC (rev 3246)
+++ CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/localization.py 2008-10-28 20:21:38 UTC (rev 3247)
@@ -95,14 +95,14 @@
translations = {}
- def __init__(self, lang, domain='calendarserver', localedir='locales'):
+ def __init__(self, lang, domain='calendarserver', localeDir='locales'):
# Cache gettext translation objects in class.translations
- key = (lang, domain, localedir)
+ key = (lang, domain, localeDir)
self.translation = self.translations.get(key, None)
if self.translation is None:
self.translation = gettext.translation(domain=domain,
- localedir=localedir, languages=[lang, 'en'])
+ localedir=localeDir, languages=[lang, 'en'])
self.translations[key] = self.translation
def __enter__(self):
@@ -139,6 +139,11 @@
All day
3:30 PM PDT
3:30 PM PDT to 7:30 PM EDT
+
+ 1 day
+ 2 days
+ 1 day 1 hour
+ 1 day 4 hours 18 minutes
"""
# Bind to '_' so pygettext.py will pick this up for translation
@@ -149,7 +154,7 @@
if isinstance(dtStart, datetime.datetime):
tzStart = dtStart.tzname()
else:
- return _("All day")
+ return ("", _("All day"))
# tzStart = component.getProperty("DTSTART").params().get("TZID", "UTC")
@@ -174,7 +179,7 @@
duration = dtEnd - dtStart
if dtStart == dtEnd:
- return self.dtTime(dtStart)
+ return (self.dtTime(dtStart), "")
return (
_("%(startTime)s to %(endTime)s")
@@ -182,7 +187,8 @@
'startTime' : self.dtTime(dtStart,
includeTimezone=(tzStart != tzEnd)),
'endTime' : self.dtTime(dtEnd),
- }
+ },
+ self.dtDuration(duration)
)
@@ -202,7 +208,7 @@
def dtTime(self, val, includeTimezone=True):
if not isinstance(val, (datetime.datetime, datetime.time)):
- return None
+ return ""
# Bind to '_' so pygettext.py will pick this up for translation
_ = self.translation.ugettext
@@ -227,9 +233,44 @@
return result
+ def dtDuration(self, val):
+ # Bind to '_' so pygettext.py will pick this up for translation
+ _ = self.translation.ugettext
+ parts = []
+ if val.days == 1:
+ parts.append(_("1 day"))
+ elif val.days > 1:
+ parts.append(_("%(dayCount)d days" %
+ { 'dayCount' : val.days }))
+
+ hours = val.seconds / 3600
+ minutes = divmod(val.seconds / 60, 60)[1]
+ seconds = divmod(val.seconds, 60)[1]
+
+ if hours == 1:
+ parts.append(_("1 hour"))
+ elif hours > 1:
+ parts.append(_("%(hourCount)d hours") %
+ { 'hourCount' : hours })
+
+ if minutes == 1:
+ parts.append(_("1 minute"))
+ elif minutes > 1:
+ parts.append(_("%(minuteCount)d minutes") %
+ { 'minuteCount' : minutes })
+
+ if seconds == 1:
+ parts.append(_("1 second"))
+ elif seconds > 1:
+ parts.append(_("%(secondCount)d seconds") %
+ { 'secondCount' : seconds })
+
+ return " ".join(parts)
+
+
# The strings below are wrapped in _( ) for the benefit of pygettext. We don't
# actually want them translated until they're used.
Modified: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/mail.py
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/mail.py 2008-10-28 18:21:44 UTC (rev 3246)
+++ CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/mail.py 2008-10-28 20:21:38 UTC (rev 3247)
@@ -483,7 +483,7 @@
calendar = ical.Component.fromString(request.content.read())
headers = request.getAllHeaders()
self.mailer.outbound(headers['originator'], headers['recipient'],
- calendar, language='en')
+ calendar, language='fr')
# TODO: what to return?
return """
@@ -739,6 +739,7 @@
details['inviteLabel'] = _("Event Invitation")
details['dateLabel'] = _("Date")
details['timeLabel'] = _("Time")
+ details['durationLabel'] = _("Duration")
details['descLabel'] = _("Description")
details['orgLabel'] = _("Organizer")
details['attLabel'] = _("Attendees")
@@ -751,6 +752,7 @@
%(locLabel)s: %(location)s
%(dateLabel)s: %(dateInfo)s
%(timeLabel)s: %(timeInfo)s
+%(durationLabel)s: %(durationInfo)s
%(descLabel)s: %(description)s
%(attLabel)s: %(attendees)s
"""
@@ -759,7 +761,7 @@
if cancelled:
plainText = _("Event cancelled")
else:
- print plainTemplate, details
+ # print plainTemplate, details
plainText = plainTemplate % details
msgPlain = MIMEText(plainText.encode("UTF-8"), "plain", "UTF-8")
@@ -789,6 +791,9 @@
<h3>%(timeLabel)s:</h3> %(timeInfo)s
</p>
<p>
+ <h3>%(durationLabel)s:</h3> %(durationInfo)s
+ </p>
+ <p>
<h3>%(descLabel)s:</h3> %(description)s
</p>
<p>
@@ -869,7 +874,7 @@
with translationTo(language) as trans:
results['dateInfo'] = trans.date(component)
- results['timeInfo'] = trans.time(component)
+ results['timeInfo'], results['durationInfo'] = trans.time(component)
return results
Added: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/en/LC_MESSAGES/calendarserver.mo
===================================================================
(Binary files differ)
Property changes on: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/en/LC_MESSAGES/calendarserver.mo
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/en/LC_MESSAGES/calendarserver.po
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/en/LC_MESSAGES/calendarserver.po (rev 0)
+++ CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/en/LC_MESSAGES/calendarserver.po 2008-10-28 20:21:38 UTC (rev 3247)
@@ -0,0 +1,249 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR ORGANIZATION
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2008-10-24 15:03+PDT\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: pygettext.py 1.5\n"
+
+
+#: localization.py:171
+msgid "All day"
+msgstr ""
+
+#: localization.py:177
+msgid "%(startTime)s to %(endTime)s"
+msgstr ""
+
+#: localization.py:191
+msgid "%(dayName)s, %(monthName)s %(dayNumber)d, %(yearNumber)d"
+msgstr ""
+
+#: localization.py:207
+msgid "AM"
+msgstr ""
+
+#: localization.py:207
+msgid "PM"
+msgstr ""
+
+#: localization.py:213
+msgid "%(hour12Number)d:%(minuteNumber)02d %(ampm)s"
+msgstr ""
+
+#: localization.py:236
+msgid "Monday"
+msgstr ""
+
+#: localization.py:237
+msgid "Tuesday"
+msgstr ""
+
+#: localization.py:238
+msgid "Wednesday"
+msgstr ""
+
+#: localization.py:239
+msgid "Thursday"
+msgstr ""
+
+#: localization.py:240
+msgid "Friday"
+msgstr ""
+
+#: localization.py:241
+msgid "Saturday"
+msgstr ""
+
+#: localization.py:242
+msgid "Sunday"
+msgstr ""
+
+#: localization.py:246
+msgid "Mon"
+msgstr ""
+
+#: localization.py:247
+msgid "Tue"
+msgstr ""
+
+#: localization.py:248
+msgid "Wed"
+msgstr ""
+
+#: localization.py:249
+msgid "Thu"
+msgstr ""
+
+#: localization.py:250
+msgid "Fri"
+msgstr ""
+
+#: localization.py:251
+msgid "Sun"
+msgstr ""
+
+#: localization.py:252
+msgid "Sat"
+msgstr ""
+
+#: localization.py:257
+msgid "January"
+msgstr ""
+
+#: localization.py:258
+msgid "February"
+msgstr ""
+
+#: localization.py:259
+msgid "March"
+msgstr ""
+
+#: localization.py:260
+msgid "April"
+msgstr ""
+
+#: localization.py:261 localization.py:277
+msgid "May"
+msgstr ""
+
+#: localization.py:262
+msgid "June"
+msgstr ""
+
+#: localization.py:263
+msgid "July"
+msgstr ""
+
+#: localization.py:264
+msgid "August"
+msgstr ""
+
+#: localization.py:265
+msgid "September"
+msgstr ""
+
+#: localization.py:266
+msgid "October"
+msgstr ""
+
+#: localization.py:267
+msgid "November"
+msgstr ""
+
+#: localization.py:268
+msgid "December"
+msgstr ""
+
+#: localization.py:273
+msgid "Jan"
+msgstr ""
+
+#: localization.py:274
+msgid "Feb"
+msgstr ""
+
+#: localization.py:275
+msgid "Mar"
+msgstr ""
+
+#: localization.py:276
+msgid "Apr"
+msgstr ""
+
+#: localization.py:278
+msgid "Jun"
+msgstr ""
+
+#: localization.py:279
+msgid "Jul"
+msgstr ""
+
+#: localization.py:280
+msgid "Aug"
+msgstr ""
+
+#: localization.py:281
+msgid "Sep"
+msgstr ""
+
+#: localization.py:282
+msgid "Oct"
+msgstr ""
+
+#: localization.py:283
+msgid "Nov"
+msgstr ""
+
+#: localization.py:284
+msgid "Dec"
+msgstr ""
+
+#: mail.py:726 mail.py:755 mail.py:792
+msgid "Event cancelled"
+msgstr ""
+
+#: mail.py:727
+msgid "Event invitation: %(summary)s"
+msgstr ""
+
+#: mail.py:736
+msgid "Event Invitation"
+msgstr ""
+
+#: mail.py:737
+msgid "Date"
+msgstr ""
+
+#: mail.py:738
+msgid "Time"
+msgstr ""
+
+#: mail.py:739
+msgid "Description"
+msgstr ""
+
+#: mail.py:740
+msgid "Organizer"
+msgstr ""
+
+#: mail.py:741
+msgid "Attendees"
+msgstr ""
+
+#: mail.py:742
+msgid "Location"
+msgstr ""
+
+
+msgid "1 day"
+msgstr
+
+msgid "%(dayCount)d days"
+msgstr
+
+msgid "1 hour"
+
+msgid "%(hourCount)d hours"
+msgstr
+
+msgid "1 minute"
+msgstr
+
+msgid "%(minuteCount)d minutes"
+msgstr
+
+msgid "1 second"
+msgstr
+
+msgid "%(secondCount)d seconds"
+msgstr
+
Added: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/pig/LC_MESSAGES/calendarserver.mo
===================================================================
(Binary files differ)
Property changes on: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/pig/LC_MESSAGES/calendarserver.mo
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/pig/LC_MESSAGES/calendarserver.po
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/pig/LC_MESSAGES/calendarserver.po (rev 0)
+++ CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/data/locales/pig/LC_MESSAGES/calendarserver.po 2008-10-28 20:21:38 UTC (rev 3247)
@@ -0,0 +1,250 @@
+# Pig Latin Translation
+# Copyright (C) YEAR ORGANIZATION
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2008-10-24 15:03+PDT\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: pygettext.py 1.5\n"
+
+
+#: localization.py:171
+msgid "All day"
+msgstr "Allway ayday"
+
+#: localization.py:177
+msgid "%(startTime)s to %(endTime)s"
+msgstr "%(startTime)s otay %(endTime)s"
+
+#: localization.py:191
+msgid "%(dayName)s, %(monthName)s %(dayNumber)d, %(yearNumber)d"
+msgstr "%(dayName)s, %(monthName)s %(dayNumber)d, %(yearNumber)d"
+
+#: localization.py:207
+msgid "AM"
+msgstr "AMWAY"
+
+#: localization.py:207
+msgid "PM"
+msgstr "PMAY"
+
+#: localization.py:213
+msgid "%(hour12Number)d:%(minuteNumber)02d %(ampm)s"
+msgstr "%(hour24Number)02d:%(minuteNumber)02d"
+
+#: localization.py:236
+msgid "Monday"
+msgstr "Ondaymay"
+
+#: localization.py:237
+msgid "Tuesday"
+msgstr "Uesdaytay"
+
+#: localization.py:238
+msgid "Wednesday"
+msgstr "Ednesdayway"
+
+#: localization.py:239
+msgid "Thursday"
+msgstr "Ursdaythay"
+
+#: localization.py:240
+msgid "Friday"
+msgstr "Idayfray"
+
+#: localization.py:241
+msgid "Saturday"
+msgstr "Aturdaysay"
+
+#: localization.py:242
+msgid "Sunday"
+msgstr "Undaysay"
+
+#: localization.py:246
+msgid "Mon"
+msgstr ""
+
+#: localization.py:247
+msgid "Tue"
+msgstr ""
+
+#: localization.py:248
+msgid "Wed"
+msgstr ""
+
+#: localization.py:249
+msgid "Thu"
+msgstr ""
+
+#: localization.py:250
+msgid "Fri"
+msgstr ""
+
+#: localization.py:251
+msgid "Sun"
+msgstr ""
+
+#: localization.py:252
+msgid "Sat"
+msgstr ""
+
+#: localization.py:257
+msgid "January"
+msgstr "Anuaryjay"
+
+#: localization.py:258
+msgid "February"
+msgstr "Ebruaryfay"
+
+#: localization.py:259
+msgid "March"
+msgstr "Archmay"
+
+#: localization.py:260
+msgid "April"
+msgstr "Aprilway"
+
+#: localization.py:261 localization.py:277
+msgid "May"
+msgstr "Aymay"
+
+#: localization.py:262
+msgid "June"
+msgstr "Unejay"
+
+#: localization.py:263
+msgid "July"
+msgstr "Ulyjay"
+
+#: localization.py:264
+msgid "August"
+msgstr "Augustway"
+
+#: localization.py:265
+msgid "September"
+msgstr "Eptembersay"
+
+#: localization.py:266
+msgid "October"
+msgstr "Octoberway"
+
+#: localization.py:267
+msgid "November"
+msgstr "Ovembernay"
+
+#: localization.py:268
+msgid "December"
+msgstr "Ecemberday"
+
+#: localization.py:273
+msgid "Jan"
+msgstr ""
+
+#: localization.py:274
+msgid "Feb"
+msgstr ""
+
+#: localization.py:275
+msgid "Mar"
+msgstr ""
+
+#: localization.py:276
+msgid "Apr"
+msgstr ""
+
+#: localization.py:278
+msgid "Jun"
+msgstr ""
+
+#: localization.py:279
+msgid "Jul"
+msgstr ""
+
+#: localization.py:280
+msgid "Aug"
+msgstr ""
+
+#: localization.py:281
+msgid "Sep"
+msgstr ""
+
+#: localization.py:282
+msgid "Oct"
+msgstr ""
+
+#: localization.py:283
+msgid "Nov"
+msgstr ""
+
+#: localization.py:284
+msgid "Dec"
+msgstr ""
+
+#: mail.py:726 mail.py:755 mail.py:792
+msgid "Event cancelled"
+msgstr "Eventway ancelledcay"
+
+#: mail.py:727
+msgid "Event invitation: %(summary)s"
+msgstr "Eventway invitationway: %(summary)s"
+
+#: mail.py:736
+msgid "Event Invitation"
+msgstr "Eventway invitationway"
+
+#: mail.py:737
+msgid "Date"
+msgstr "Ateday"
+
+#: mail.py:738
+msgid "Time"
+msgstr "Imetay"
+
+#: mail.py:739
+msgid "Description"
+msgstr "Escriptionday"
+
+#: mail.py:740
+msgid "Organizer"
+msgstr "Organizerway"
+
+#: mail.py:741
+msgid "Attendees"
+msgstr "Attendeesway"
+
+#: mail.py:742
+msgid "Location"
+msgstr "Ocationlay"
+
+
+msgid "1 day"
+msgstr "1 ayday"
+
+msgid "%(dayCount)d days"
+msgstr "%(dayCount)d aysday"
+
+msgid "1 hour"
+msgstr "1 ourhay"
+
+msgid "%(hourCount)d hours"
+msgstr "%(hourCount)d ourshay"
+
+msgid "1 minute"
+msgstr "1 inutemay"
+
+msgid "%(minuteCount)d minutes"
+msgstr "%(minuteCount)d inutesmay"
+
+msgid "1 second"
+msgstr "1 econdsay"
+
+msgid "%(secondCount)d seconds"
+msgstr "%(secondCount)d econdsay"
+
Added: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/test_localization.py
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/test_localization.py (rev 0)
+++ CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/test/test_localization.py 2008-10-28 20:21:38 UTC (rev 3247)
@@ -0,0 +1,137 @@
+##
+# Copyright (c) 2008 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+from __future__ import with_statement
+
+from twisted.trial.unittest import TestCase
+from twistedcaldav.localization import translationTo
+from twistedcaldav.ical import Component
+from datetime import datetime, time
+import os
+
+def getComp(str):
+ calendar = Component.fromString(str)
+ comp = calendar.masterComponent()
+ if comp is None:
+ comp = calendar.mainComponent(True)
+ return comp
+
+data = (
+ ('1-hour-long-morning', getComp('BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:REQUEST\r\nPRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN\r\nBEGIN:VTIMEZONE\r\nTZID:US/Pacific\r\nBEGIN:STANDARD\r\nDTSTART:20071104T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nTZNAME:PST\r\nTZOFFSETFROM:-0700\r\nTZOFFSETTO:-0800\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:20070311T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nTZNAME:PDT\r\nTZOFFSETFROM:-0800\r\nTZOFFSETTO:-0700\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:C7C037CC-1485-461B-8866-777C662C5930\r\nDTSTART;TZID=US/Pacific:20081025T091500\r\nDTEND;TZID=US/Pacific:20081025T101501\r\nATTENDEE;CN=test at systemcall.com;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSV\r\n P=TRUE:mailto:test at systemcall.com\r\nATTENDEE;CN=Test User;CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED:mailto:testuser@\r\n example.com\r\nCREATED:20081024T181749Z\r\nDTSTAMP:20081024T183142Z\r\nORGANIZER;CN=Test User:mailto:testuser at ex
ample.com\r\nSEQUENCE:5\r\nSUMMARY:testing\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n')),
+
+ ('2-hour-long-evening', getComp('BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:REQUEST\r\nPRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN\r\nBEGIN:VTIMEZONE\r\nTZID:US/Pacific\r\nBEGIN:STANDARD\r\nDTSTART:20071104T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nTZNAME:PST\r\nTZOFFSETFROM:-0700\r\nTZOFFSETTO:-0800\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:20070311T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nTZNAME:PDT\r\nTZOFFSETFROM:-0800\r\nTZOFFSETTO:-0700\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:C7C037CC-1485-461B-8866-777C662C5930\r\nDTSTART;TZID=US/Pacific:20081025T131500\r\nDTEND;TZID=US/Pacific:20081025T151502\r\nATTENDEE;CN=test at systemcall.com;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSV\r\n P=TRUE:mailto:test at systemcall.com\r\nATTENDEE;CN=Test User;CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED:mailto:testuser@\r\n example.com\r\nCREATED:20081024T181749Z\r\nDTSTAMP:20081024T183142Z\r\nORGANIZER;CN=Test User:mailto:testuser at ex
ample.com\r\nSEQUENCE:5\r\nSUMMARY:testing\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n')),
+
+ ('3-hour-long-cross-noon', getComp('BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:REQUEST\r\nPRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN\r\nBEGIN:VTIMEZONE\r\nTZID:US/Pacific\r\nBEGIN:STANDARD\r\nDTSTART:20071104T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nTZNAME:PST\r\nTZOFFSETFROM:-0700\r\nTZOFFSETTO:-0800\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:20070311T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nTZNAME:PDT\r\nTZOFFSETFROM:-0800\r\nTZOFFSETTO:-0700\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:C7C037CC-1485-461B-8866-777C662C5930\r\nDTSTART;TZID=US/Pacific:20081025T110500\r\nDTEND;TZID=US/Pacific:20081025T141500\r\nATTENDEE;CN=test at systemcall.com;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSV\r\n P=TRUE:mailto:test at systemcall.com\r\nATTENDEE;CN=Test User;CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED:mailto:testuser@\r\n example.com\r\nCREATED:20081024T181749Z\r\nDTSTAMP:20081024T183142Z\r\nORGANIZER;CN=Test User:mailto:testuser
@example.com\r\nSEQUENCE:5\r\nSUMMARY:testing\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n')),
+
+ ('all-day', getComp('BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:REQUEST\r\nPRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN\r\nBEGIN:VTIMEZONE\r\nTZID:US/Pacific\r\nBEGIN:STANDARD\r\nDTSTART:20071104T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nTZNAME:PST\r\nTZOFFSETFROM:-0700\r\nTZOFFSETTO:-0800\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:20070311T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nTZNAME:PDT\r\nTZOFFSETFROM:-0800\r\nTZOFFSETTO:-0700\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:C7C037CC-1485-461B-8866-777C662C5930\r\nDTSTART;TZID=US/Pacific:20081025\r\nATTENDEE;CN=test at systemcall.com;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSV\r\n P=TRUE:mailto:test at systemcall.com\r\nATTENDEE;CN=Test User;CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED:mailto:testuser@\r\n example.com\r\nCREATED:20081024T181749Z\r\nDTSTAMP:20081024T183142Z\r\nORGANIZER;CN=Test User:mailto:testuser at example.com\r\nSEQUENCE:5\r\nSUMMARY:testing\r\nTRANSP:OPAQUE\
r\nEND:VEVENT\r\nEND:VCALENDAR\r\n')),
+
+ ('instantaneous', getComp('BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:REQUEST\r\nPRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN\r\nBEGIN:VTIMEZONE\r\nTZID:US/Pacific\r\nBEGIN:STANDARD\r\nDTSTART:20071104T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nTZNAME:PST\r\nTZOFFSETFROM:-0700\r\nTZOFFSETTO:-0800\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:20070311T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nTZNAME:PDT\r\nTZOFFSETFROM:-0800\r\nTZOFFSETTO:-0700\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:C7C037CC-1485-461B-8866-777C662C5930\r\nDTSTART;TZID=US/Pacific:20081025T131500\r\nDTEND;TZID=US/Pacific:20081025T131500\r\nATTENDEE;CN=test at systemcall.com;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSV\r\n P=TRUE:mailto:test at systemcall.com\r\nATTENDEE;CN=Test User;CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED:mailto:testuser@\r\n example.com\r\nCREATED:20081024T181749Z\r\nDTSTAMP:20081024T183142Z\r\nORGANIZER;CN=Test User:mailto:testuser at example.
com\r\nSEQUENCE:5\r\nSUMMARY:testing\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n')),
+
+ ('cross-timezone', getComp('BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:REQUEST\r\nPRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN\r\nBEGIN:VTIMEZONE\r\nTZID:US/Pacific\r\nBEGIN:STANDARD\r\nDTSTART:20071104T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nTZNAME:PST\r\nTZOFFSETFROM:-0700\r\nTZOFFSETTO:-0800\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:20070311T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nTZNAME:PDT\r\nTZOFFSETFROM:-0800\r\nTZOFFSETTO:-0700\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VTIMEZONE\r\nTZID:US/Eastern\r\nBEGIN:STANDARD\r\nDTSTART:20071104T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nTZNAME:EST\r\nTZOFFSETFROM:-0400\r\nTZOFFSETTO:-0500\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:20070311T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nTZNAME:EDT\r\nTZOFFSETFROM:-0500\r\nTZOFFSETTO:-0400\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:C7C037CC-1485-461B-8866-777C662C5930\r\nDTSTART;TZID=US/Pacific:
20081025T110500\r\nDTEND;TZID=US/Eastern:20081025T181500\r\nATTENDEE;CN=test at systemcall.com;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSV\r\n P=TRUE:mailto:test at systemcall.com\r\nATTENDEE;CN=Test User;CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED:mailto:testuser@\r\n example.com\r\nCREATED:20081024T181749Z\r\nDTSTAMP:20081024T183142Z\r\nORGANIZER;CN=Test User:mailto:testuser at example.com\r\nSEQUENCE:5\r\nSUMMARY:testing\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n')),
+
+
+)
+
+localeDir = os.path.join(os.path.dirname(__file__), "data", "locales")
+
+class LocalizationTests(TestCase):
+
+ def test_BasicStringLocalization(self):
+
+ with translationTo('pig', localeDir=localeDir):
+
+ self.assertEquals(_("All day"), "Allway ayday")
+
+ self.assertEquals(_("%(startTime)s to %(endTime)s") %
+ { 'startTime' : 'a', 'endTime' : 'b' },
+ "a otay b"
+ )
+
+ def test_TimeFormattingAMPM(self):
+
+ with translationTo('en', localeDir=localeDir) as t:
+
+ self.assertEquals(t.dtTime(time(0,0)), "12:00 AM")
+ self.assertEquals(t.dtTime(time(12,0)), "12:00 PM")
+ self.assertEquals(t.dtTime(time(23,59)), "11:59 PM")
+ self.assertEquals(t.dtTime(time(6,5)), "6:05 AM")
+ self.assertEquals(t.dtTime(time(16,5)), "4:05 PM")
+
+ def test_TimeFormatting24Hour(self):
+
+ with translationTo('pig', localeDir=localeDir) as t:
+
+ self.assertEquals(t.dtTime(time(0,0)), "00:00")
+ self.assertEquals(t.dtTime(time(12,0)), "12:00")
+ self.assertEquals(t.dtTime(time(23,59)), "23:59")
+ self.assertEquals(t.dtTime(time(6,5)), "06:05")
+ self.assertEquals(t.dtTime(time(16,5)), "16:05")
+
+ def test_CalendarFormatting(self):
+
+ with translationTo('en', localeDir=localeDir) as t:
+
+ comp = data[0][1]
+ self.assertEquals(t.date(comp), "Saturday, October 25, 2008")
+ self.assertEquals(t.time(comp),
+ (u'9:15 AM to 10:15 AM PDT', u'1 hour 1 second'))
+
+ comp = data[1][1]
+ self.assertEquals(t.time(comp),
+ (u'1:15 PM to 3:15 PM PDT', u'2 hours 2 seconds'))
+
+ comp = data[2][1]
+ self.assertEquals(t.time(comp),
+ (u'11:05 AM to 2:15 PM PDT', u'3 hours 10 minutes'))
+
+ comp = data[3][1]
+ self.assertEquals(t.time(comp),
+ ("", u'All day'))
+
+ comp = data[4][1]
+ self.assertEquals(t.time(comp),
+ (u'1:15 PM PDT', ""))
+
+ comp = data[5][1]
+ self.assertEquals(t.time(comp),
+ (u'11:05 AM PDT to 6:15 PM EDT', u'4 hours 10 minutes'))
+
+ with translationTo('pig', localeDir=localeDir) as t:
+
+ comp = data[0][1]
+ self.assertEquals(t.date(comp), 'Aturdaysay, Octoberway 25, 2008')
+ self.assertEquals(t.time(comp),
+ (u'09:15 otay 10:15 PDT', u'1 ourhay 1 econdsay'))
+
+ comp = data[1][1]
+ self.assertEquals(t.time(comp),
+ (u'13:15 otay 15:15 PDT', u'2 ourshay 2 econdsay'))
+
+ comp = data[2][1]
+ self.assertEquals(t.time(comp),
+ (u'11:05 otay 14:15 PDT', u'3 ourshay 10 inutesmay'))
+
+ comp = data[3][1]
+ self.assertEquals(t.time(comp),
+ ("", u'Allway ayday'))
+
+ comp = data[4][1]
+ self.assertEquals(t.time(comp),
+ (u'13:15 PDT', ""))
+
+ comp = data[5][1]
+ self.assertEquals(t.time(comp),
+ (u'11:05 PDT otay 18:15 EDT', u'4 ourshay 10 inutesmay'))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081028/417377f0/attachment-0001.html>
More information about the calendarserver-changes
mailing list