[hamster-applet] simplified some of the date formatting strings and added comments



commit d5bbdac9775c1b1fd4a2cc3feb437c53cfa6c733
Author: Toms Bauģis <toms baugis gmail com>
Date:   Wed Aug 12 18:09:45 2009 +0300

    simplified some of the date formatting strings and added comments

 hamster/reports.py |    7 ++-
 hamster/stats.py   |   58 ++++++++++++++-------
 po/lv.po           |  142 +++++++++++++++++++++++++++++-----------------------
 3 files changed, 123 insertions(+), 84 deletions(-)
---
diff --git a/hamster/reports.py b/hamster/reports.py
index 9a68708..b76b098 100644
--- a/hamster/reports.py
+++ b/hamster/reports.py
@@ -261,8 +261,11 @@ class HTMLWriter(ReportWriter):
                             <td class="largeCell">%s</td>
                         </tr>
                        """ % (int(self.even_row),
-                              C_("date column for each row in HTML report",
-                                 "%(b)s %(d)s, %(Y)s") % stuff.dateDict(fact["start_time"]),
+                              fact["start_time"].strftime(
+                                # date column format for each row in HTML report
+                                # Using python datetime formatting syntax. See:
+                                # http://docs.python.org/library/time.html#time.strftime
+                                C_("html report","%b %d, %Y")),
                               fact["name"],
                               category, 
                               fact["start_time"].strftime('%H:%M'),
diff --git a/hamster/stats.py b/hamster/stats.py
index 12522ca..4677a55 100644
--- a/hamster/stats.py
+++ b/hamster/stats.py
@@ -651,13 +651,15 @@ A week of usage would be nice!"""))
 
         # first record        
         if not year:
-            #date of first record for case when year has not been selected
-            first_date = C_("first record", "%(b)s %(d)s, %(Y)s") % \
-                               stuff.dateDict(facts[0]["start_time"])
+            # date format for the first record if the year has not been selected
+            # Using python datetime formatting syntax. See:
+            # http://docs.python.org/library/time.html#time.strftime
+            first_date = facts[0]["start_time"].strftime(C_("first record", "%b %d, %Y"))
         else:
-            #date of first record when year has been selected
-            first_date = C_("first record", "%(b)s %(d)s") % \
-                               stuff.dateDict(facts[0]["start_time"])
+            # date of first record when year has been selected
+            # Using python datetime formatting syntax. See:
+            # http://docs.python.org/library/time.html#time.strftime
+            first_date = facts[0]["start_time"].strftime(C_("first record", "%(b)s %(d)s"))
 
         summary += _("First activity was recorded on %s.") % \
                                                      ("<b>%s</b>" % first_date)
@@ -691,15 +693,21 @@ A week of usage would be nice!"""))
             if not max_fact or fact["delta"] > max_fact["delta"]:
                 max_fact = fact
 
-        datedict = stuff.dateDict(max_fact["start_time"], "max_")
+        longest_date = max_fact["start_time"].strftime(
+            # How the date of the longest activity should be displayed in statistics
+            # Using python datetime formatting syntax. See:
+            # http://docs.python.org/library/time.html#time.strftime
+            C_("date of the longest activity", "%b %d, %Y"))
+        
         num_hours = max_fact["delta"].seconds / 60 / 60.0 + max_fact["delta"].days * 24
-        datedict["hours"] = "<b>%.1f</b>" % (num_hours)
-
+        hours = "<b>%.1f</b>" % (num_hours)
+        
         summary += "\n" + ngettext("Longest continuous work happened on \
-%(max_b)s %(max_d)s, %(max_Y)s and was %(hours)s hour.",
+%(date)s and was %(hours)s hour.",
                                   "Longest continuous work happened on \
-%(max_b)s %(max_d)s, %(max_Y)s and was %(hours)s hours.",
-                                  int(num_hours)) % datedict
+%(date)s and was %(hours)s hours.",
+                                  int(num_hours)) % {"date": longest_date,
+                                                     "hours": hours}
 
         # total records (in selected scope)
         summary += " " + ngettext("There is %s record.",
@@ -814,9 +822,10 @@ than 15 minutes you seem to be a busy bee." % ("<b>%d</b>" % short_percent))
         for i in range((self.end_date - self.start_date).days  + 1):
             current_date = self.start_date + dt.timedelta(i)
             
-            # date format in overview window fact listing
-            # prefix is "o_",letter after prefix is regular python format. you can use all of them
-            fact_date = C_("overview list", "%(A)s, %(b)s %(d)s") %  stuff.dateDict(current_date)
+            # Date format for the label in overview window fact listing
+            # Using python datetime formatting syntax. See:
+            # http://docs.python.org/library/time.html#time.strftime
+            fact_date = current_date.strftime(C_("overview list", "%A, %b %d"))
             
             day_total = dt.timedelta()
             for fact in day_dict.get(current_date, []):
@@ -876,7 +885,10 @@ than 15 minutes you seem to be a busy bee." % ("<b>%d</b>" % short_percent))
         if (self.end_date - self.start_date).days < 20:
             day_keys = [day.strftime("%a") for day in all_days]
         else:
-            day_keys = [C_("overview graph", "%(b)s %(d)s") %  stuff.dateDict(day)
+            # date format used in the overview graph when month view is selected
+            # Using python datetime formatting syntax. See:
+            # http://docs.python.org/library/time.html#time.strftime
+            day_keys = [day.strftime(C_("overview graph", "%b %d"))
                                                             for day in all_days]
 
         self.day_chart.plot(day_keys, res, stack_keys = all_categories)
@@ -901,9 +913,14 @@ than 15 minutes you seem to be a busy bee." % ("<b>%d</b>" % short_percent))
 
     def set_title(self):
         if self.day_view.get_active():
-            overview_label = C_("single day overview",
-                                u"Overview for %(B)s %(d)s, %(Y)s") % \
-                                stuff.dateDict(self.view_date)
+            # date format for overview label when only single day is visible
+            # Using python datetime formatting syntax. See:
+            # http://docs.python.org/library/time.html#time.strftime
+            start_date_str = self.view_date.strftime("single day overview",
+                                                     "%B %d, %Y")
+            # Overview label if looking on single day
+            overview_label = _(u"Overview for %(date)s") % \
+                                                      ({"date": start_date_str})
         else:
             dates_dict = stuff.dateDict(self.start_date, "start_")
             dates_dict.update(stuff.dateDict(self.end_date, "end_"))
@@ -912,16 +929,19 @@ than 15 minutes you seem to be a busy bee." % ("<b>%d</b>" % short_percent))
                 # overview label if start and end years don't match
                 # letter after prefixes (start_, end_) is the one of
                 # standard python date formatting ones- you can use all of them
+                # see http://docs.python.org/library/time.html#time.strftime
                 overview_label = _(u"Overview for %(start_B)s %(start_d)s, %(start_Y)s â?? %(end_B)s %(end_d)s, %(end_Y)s") % dates_dict
             elif self.start_date.month != self.end_date.month:
                 # overview label if start and end month do not match
                 # letter after prefixes (start_, end_) is the one of
                 # standard python date formatting ones- you can use all of them
+                # see http://docs.python.org/library/time.html#time.strftime
                 overview_label = _(u"Overview for %(start_B)s %(start_d)s â?? %(end_B)s %(end_d)s, %(end_Y)s") % dates_dict
             else:
                 # overview label for interval in same month
                 # letter after prefixes (start_, end_) is the one of
                 # standard python date formatting ones- you can use all of them
+                # see http://docs.python.org/library/time.html#time.strftime
                 overview_label = _(u"Overview for %(start_B)s %(start_d)s â?? %(end_d)s, %(end_Y)s") % dates_dict
 
         if self.week_view.get_active():
diff --git a/po/lv.po b/po/lv.po
index c2f9abb..26560f7 100644
--- a/po/lv.po
+++ b/po/lv.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: lv\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-08-12 16:35+0300\n"
+"POT-Creation-Date: 2009-08-12 18:04+0300\n"
 "PO-Revision-Date: 2008-03-30 00:51+0000\n"
 "Last-Translator: Toms Bauģis <toms baugis gmail com>\n"
 "Language-Team: Latvian <locale laka lv>\n"
@@ -160,8 +160,8 @@ msgstr "Karstais taustiÅ?Å¡ laika uzskaites sÄ«klietotnes parÄ?dÄ«Å¡anai"
 
 #: ../data/hamster-applet.schemas.in.h:4
 msgid ""
-"Remind of current task every specified amount of minutes. Set to 0 or bigger "
-"than 120 to disable reminder."
+"Remind of current task every specified amount of minutes. Set to 0 or "
+"greater than 120 to disable reminder."
 msgstr ""
 "AtgÄ?dinÄ?t par paÅ¡reizÄ?jo darbÄ«bu ik pÄ?c norÄ?dÄ«tÄ?m minÅ«tÄ?m. IzslÄ?gt "
 "atgÄ?dinÄ?jumus var Å¡eit ierakstot 0 vai skaitli lielÄ?ku par 120"
@@ -254,7 +254,7 @@ msgstr "<b>SÄ?kumi un beigas</b>"
 msgid "<b>Totals</b>"
 msgstr "<b>Kopsummas</b>"
 
-#: ../data/stats.ui.h:7 ../hamster/reports.py:231 ../hamster/reports.py:289
+#: ../data/stats.ui.h:7 ../hamster/reports.py:231 ../hamster/reports.py:292
 msgid "Activity"
 msgstr "Nodarbe"
 
@@ -294,7 +294,7 @@ msgstr "Statistika"
 msgid "Today"
 msgstr "Å odiena"
 
-#: ../data/stats.ui.h:17 ../hamster/stats.py:928
+#: ../data/stats.ui.h:17 ../hamster/stats.py:948
 msgid "Week"
 msgstr "NedÄ?ļa"
 
@@ -303,8 +303,8 @@ msgid "Year:"
 msgstr "Gads:"
 
 #: ../hamster/about.py:41
-msgid "Copyright © 2007-2009 Toms Bauģis and others"
-msgstr "Autortiesības © 2007-2009 Toms Bauģis un citi"
+msgid "Copyright © 2007â??2009 Toms BauÄ£is and others"
+msgstr "AutortiesÄ«bas © 2007â??2009 Toms BauÄ£is un citi"
 
 #: ../hamster/about.py:43
 msgid "Project Hamster Website"
@@ -329,7 +329,7 @@ msgid "Switch"
 msgstr "PÄ?rslÄ?gt darbÄ«bu"
 
 #: ../hamster/applet.py:305 ../hamster/reports.py:235
-#: ../hamster/reports.py:290
+#: ../hamster/reports.py:293
 msgid "Duration"
 msgstr "Ilgums"
 
@@ -446,7 +446,7 @@ msgid "Name"
 msgstr "Nosaukums"
 
 #: ../hamster/preferences.py:124 ../hamster/reports.py:232
-#: ../hamster/reports.py:288
+#: ../hamster/reports.py:291
 msgid "Category"
 msgstr "Kategorija"
 
@@ -502,7 +502,8 @@ msgstr "apraksts"
 #. overview label if start and end years don't match
 #. letter after prefixes (start_, end_) is the one of
 #. standard python date formatting ones- you can use all of them
-#: ../hamster/reports.py:160 ../hamster/stats.py:915
+#. see http://docs.python.org/library/time.html#time.strftime
+#: ../hamster/reports.py:160 ../hamster/stats.py:933
 #, python-format
 msgid ""
 "Overview for %(start_B)s %(start_d)s, %(start_Y)s â?? %(end_B)s %(end_d)s, %"
@@ -513,7 +514,8 @@ msgstr ""
 #. overview label if start and end month do not match
 #. letter after prefixes (start_, end_) is the one of
 #. standard python date formatting ones- you can use all of them
-#: ../hamster/reports.py:162 ../hamster/stats.py:920
+#. see http://docs.python.org/library/time.html#time.strftime
+#: ../hamster/reports.py:162 ../hamster/stats.py:939
 #, python-format
 msgid "Overview for %(start_B)s %(start_d)s â?? %(end_B)s %(end_d)s, %(end_Y)s"
 msgstr "%(start_B)s %(start_d)s â?? %(end_B)s %(end_d)s, %(end_Y)s"
@@ -521,7 +523,8 @@ msgstr "%(start_B)s %(start_d)s â?? %(end_B)s %(end_d)s, %(end_Y)s"
 #. overview label for interval in same month
 #. letter after prefixes (start_, end_) is the one of
 #. standard python date formatting ones- you can use all of them
-#: ../hamster/reports.py:164 ../hamster/stats.py:925
+#. see http://docs.python.org/library/time.html#time.strftime
+#: ../hamster/reports.py:164 ../hamster/stats.py:945
 #, python-format
 msgid "Overview for %(start_B)s %(start_d)s â?? %(end_d)s, %(end_Y)s"
 msgstr "%(start_d)s. %(start_B)s  â?? %(end_d)s. %(start_B)s, %(end_Y)s"
@@ -547,22 +550,24 @@ msgstr "Beigas"
 msgid "Description"
 msgstr "Apraksts"
 
-#: ../hamster/reports.py:265
-#, python-format
-msgctxt "date column for each row in HTML report"
-msgid "%(b)s %(d)s, %(Y)s"
-msgstr "%(b)s %(d)s, %(Y)s"
+#. date column format for each row in HTML report
+#. Using python datetime formatting syntax. See:
+#. http://docs.python.org/library/time.html#time.strftime
+#: ../hamster/reports.py:268
+msgctxt "html report"
+msgid "%b %d, %Y"
+msgstr "%b %d, %Y"
 
 #. summary table
-#: ../hamster/reports.py:285
+#: ../hamster/reports.py:288
 msgid "Totals"
 msgstr "KopÄ?"
 
-#: ../hamster/reports.py:300
+#: ../hamster/reports.py:303
 msgid "Total Time"
 msgstr "Laiks pavisam"
 
-#: ../hamster/stats.py:64 ../hamster/stats.py:1221
+#: ../hamster/stats.py:64 ../hamster/stats.py:1241
 msgid "HTML Report"
 msgstr "HTML Atskaite"
 
@@ -570,11 +575,11 @@ msgstr "HTML Atskaite"
 msgid "Tab-Separated Values (TSV)"
 msgstr "Ar tabulatoru atdalÄ«tas vÄ?rtÄ«bas (TSV)"
 
-#: ../hamster/stats.py:80 ../hamster/stats.py:1237
+#: ../hamster/stats.py:80 ../hamster/stats.py:1257
 msgid "XML"
 msgstr "XML"
 
-#: ../hamster/stats.py:87 ../hamster/stats.py:1244
+#: ../hamster/stats.py:87 ../hamster/stats.py:1264
 msgid "iCal"
 msgstr "iCal"
 
@@ -601,26 +606,30 @@ msgstr ""
 msgid "Still collecting data â?? check back after a week has passed!"
 msgstr "VÄ?ljoprojÄ?m tiek vÄ?kti dati â?? pienÄ?ciet kad nedÄ?ļa bÅ«s pagÄ?jusi!"
 
-#. date of first record for case when year has not been selected
-#: ../hamster/stats.py:655
-#, python-format
+#. date format for the first record if the year has not been selected
+#. Using python datetime formatting syntax. See:
+#. http://docs.python.org/library/time.html#time.strftime
+#: ../hamster/stats.py:657
+#, fuzzy
 msgctxt "first record"
-msgid "%(b)s %(d)s, %(Y)s"
-msgstr "%(b)s %(d)s, %(Y)s"
+msgid "%b %d, %Y"
+msgstr "%b %d, %Y"
 
 #. date of first record when year has been selected
-#: ../hamster/stats.py:659
+#. Using python datetime formatting syntax. See:
+#. http://docs.python.org/library/time.html#time.strftime
+#: ../hamster/stats.py:662
 #, python-format
 msgctxt "first record"
 msgid "%(b)s %(d)s"
 msgstr "%(b)s %(d)s"
 
-#: ../hamster/stats.py:662
+#: ../hamster/stats.py:664
 #, python-format
 msgid "First activity was recorded on %s."
 msgstr "Pirmais ieraksts tika saglabÄ?ts %s."
 
-#: ../hamster/stats.py:671 ../hamster/stats.py:675
+#: ../hamster/stats.py:673 ../hamster/stats.py:677
 #, python-format
 msgid "%(num)s year"
 msgid_plural "%(num)s years"
@@ -629,7 +638,7 @@ msgstr[1] "%(num)s gadi"
 msgstr[2] "%(num)s gadi"
 
 #. FIXME: difficult string to properly pluralize
-#: ../hamster/stats.py:680
+#: ../hamster/stats.py:682
 #, python-format
 msgid ""
 "Time tracked so far is %(human_days)s human days (%(human_years)s) or %"
@@ -638,26 +647,31 @@ msgstr ""
 "TiktÄ?l uzskaitÄ«tas %(human_days)s cilvÄ?kdienas (%(human_years)s) jeb %"
 "(working_days)s darba dienas (%(working_years)s)."
 
-#: ../hamster/stats.py:698
+#. How the date of the longest activity should be displayed in statistics
+#. Using python datetime formatting syntax. See:
+#. http://docs.python.org/library/time.html#time.strftime
+#: ../hamster/stats.py:700
+msgctxt "date of the longest activity"
+msgid "%b %d, %Y"
+msgstr "%b %d, %Y"
+
+#: ../hamster/stats.py:705
 #, python-format
-msgid ""
-"Longest continuous work happened on %(max_b)s %(max_d)s, %(max_Y)s and was %"
-"(hours)s hour."
+msgid "Longest continuous work happened on %(date)s and was %(hours)s hour."
 msgid_plural ""
-"Longest continuous work happened on %(max_b)s %(max_d)s, %(max_Y)s and was %"
-"(hours)s hours."
+"Longest continuous work happened on %(date)s and was %(hours)s hours."
 msgstr[0] ""
 "GarÄ?kais piefiksÄ?tais nÄ?pÄ?rtrauktais darbs ir %(hours)s stundas un tika "
-"reÄ£istrÄ?ts %(max_b)s %(max_d)s, %(max_Y)s."
+"reÄ£istrÄ?ts %(date)s."
 msgstr[1] ""
 "GarÄ?kais piefiksÄ?tais nÄ?pÄ?rtrauktais darbs ir %(hours)s stundas un tika "
-"reÄ£istrÄ?ts %(max_b)s %(max_d)s, %(max_Y)s."
+"reÄ£istrÄ?ts %(date)s."
 msgstr[2] ""
 "GarÄ?kais piefiksÄ?tais nÄ?pÄ?rtrauktais darbs ir %(hours)s stundas un tika "
-"reÄ£istrÄ?ts %(max_b)s %(max_d)s, %(max_Y)s."
+"reÄ£istrÄ?ts %(date)s."
 
 #. total records (in selected scope)
-#: ../hamster/stats.py:705
+#: ../hamster/stats.py:713
 #, python-format
 msgid "There is %s record."
 msgid_plural "There are %s records."
@@ -665,11 +679,11 @@ msgstr[0] "DatubÄ?zÄ? ir %s ieraksts"
 msgstr[1] "DatubÄ?zÄ? ir %s ieraksti"
 msgstr[2] "DatubÄ?zÄ? ir %s ieraksti"
 
-#: ../hamster/stats.py:725
+#: ../hamster/stats.py:733
 msgid "Hamster would like to observe you some more!"
 msgstr "KÄ?mis vÄ?lÄ?tos jÅ«s pavÄ?rot vÄ?l kÄ?du laiku!"
 
-#: ../hamster/stats.py:727
+#: ../hamster/stats.py:735
 #, python-format
 msgid ""
 "With %s percent of all facts starting before 9am you seem to be an early "
@@ -678,7 +692,7 @@ msgstr ""
 "Spriežot pÄ?c tÄ?, ka %s procenti ierakstu reÄ£istrÄ?ti pirms deviÅ?iem rÄ«tÄ?, "
 "izskatÄ?s ka esi agrais putns."
 
-#: ../hamster/stats.py:730
+#: ../hamster/stats.py:738
 #, python-format
 msgid ""
 "With %s percent of all facts starting after 11pm you seem to be a night owl."
@@ -686,7 +700,7 @@ msgstr ""
 "Spriežot pÄ?c tÄ?, ka %s procenti ierakstu ir reÄ£istrÄ?ti pÄ?c vienpadsmitiem "
 "vakarÄ?, izskatÄ?s, ka esi pÅ«ce."
 
-#: ../hamster/stats.py:733
+#: ../hamster/stats.py:741
 #, python-format
 msgid ""
 "With %s percent of all tasks being shorter than 15 minutes you seem to be a "
@@ -695,39 +709,41 @@ msgstr ""
 "%s procenti no visiem darbiem ir isÄ?ki par piecpadsmit minÅ«tÄ?m. IzskatÄ?s ka "
 "esi varen darbīgs."
 
-#. date format in overview window fact listing
-#. prefix is "o_",letter after prefix is regular python format. you can use all of them
-#: ../hamster/stats.py:819
-#, python-format
+#. Date format for the label in overview window fact listing
+#. Using python datetime formatting syntax. See:
+#. http://docs.python.org/library/time.html#time.strftime
+#: ../hamster/stats.py:828
 msgctxt "overview list"
-msgid "%(A)s, %(b)s %(d)s"
-msgstr "%(A)s, %(b)s %(d)s"
+msgid "%A, %b %d"
+msgstr "%A, %b %d"
 
-#: ../hamster/stats.py:860
+#: ../hamster/stats.py:869
 msgid "Total"
 msgstr "KopÄ?"
 
-#: ../hamster/stats.py:879
-#, python-format
+#. date format used in the overview graph when month view is selected
+#. Using python datetime formatting syntax. See:
+#. http://docs.python.org/library/time.html#time.strftime
+#: ../hamster/stats.py:891
 msgctxt "overview graph"
-msgid "%(b)s %(d)s"
-msgstr "%(b)s %(d)s"
+msgid "%b %d"
+msgstr "%b %d"
 
-#: ../hamster/stats.py:905
+#. Overview label if looking on single day
+#: ../hamster/stats.py:922
 #, python-format
-msgctxt "single day overview"
-msgid "Overview for %(B)s %(d)s, %(Y)s"
-msgstr "%(B)s. %(d)s, %(Y)s"
+msgid "Overview for %(date)s"
+msgstr "%(date)s"
 
-#: ../hamster/stats.py:930
+#: ../hamster/stats.py:950
 msgid "Month"
 msgstr "MÄ?nesis"
 
-#: ../hamster/stats.py:932
+#: ../hamster/stats.py:952
 msgid "Day"
 msgstr "Diena"
 
-#: ../hamster/stats.py:1229
+#: ../hamster/stats.py:1249
 msgid "Tab Separated Values (TSV)"
 msgstr "Ar tabulatoru atdalÄ«tas vÄ?rtÄ«bas (TSV)"
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]