Commits

Guido Draheim committed f659f21

translate timeline messages

  • Participants
  • Parent commits 5addf24

Comments (0)

Files changed (3)

File src/dvbcronrecording/core.py

         # passing variables to template
         data = {}
         data['message'] = message
-        data['title'] = translate('Recordings List')
+        data['title'] = translate('Recording List')
         data['recordings'] = self._recordings_list(req)
         data['appends'] = req.perm.has_permission(LIST_APPEND);
         data['author'] = req.authname or ""
     def get_timeline_filters(self, req):
         filters = []
         if LIST_VIEW in req.perm:
-            filters += [ ("recordinglist", _("Recording List"))]
+            filters += [ ("recordinglist", _("Recording List"), False)]
         return filters
 
     def get_timeline_events(self, req, start, stop, filters):
         try:
-            session = db_cnx(self.env)
-            q = session.query(RecordingChanges)
-            q = q.filter(RecordingChanges.modified >= start)
-            q = q.filter(RecordingChanges.modified <= stop)
-            for item in q.all():
-                yield (PACKAGE, item.modified.replace(tzinfo=req.tz), item.username,
-                       (item.tablename, item.changed))
+            if "recordinglist" in filters:
+                session = db_cnx(self.env)
+                q = session.query(RecordingChanges)
+                q = q.filter(RecordingChanges.modified >= start)
+                q = q.filter(RecordingChanges.modified <= stop)
+                for item in q.all():
+                    yield (PACKAGE, item.modified.replace(tzinfo=req.tz), item.username,
+                           (item.tablename, item.changed))
         except Exception, e:
                 yield (PACKAGE, datetime.datetime.now(), req.authname,
                        "ERROR:%s" % str(e))
             
-    def render_timeline_event(self, req, field, event):
+    def render_timeline_event(self, context, field, event):
         tablename, changed = event[3]
         if field == 'url':
-            return req.href.recording('list')
+            return context.href.recording('list')
         elif field == 'title':
+            gettext = Translate(PACKAGE, context.req.locale)
             if changed.startswith("ACTIVATE"):
-                title = "recording list was activated"
+                title = gettext("the recording list was activated")
             else:
-                title = "recording list was modified"
+                title = gettext("a recording list entry was modified")
             return title
         elif field == 'description':
+            translate = Translate(PACKAGE, context.req.locale)
+            gettext = translate
+            mapped = {"set next recording on" : gettext("set next recording on"),
+                      "set some recording on" : gettext("set some recording on"),                      
+                      "set no recording on" : gettext("set no recording on"),
+                      "ACTIVATE: the modified recordinglist was activated":
+                        gettext("ACTIVATE: the modified recordinglist was activated")
+                      }
+            for a,b in mapped.items():
+                if changed.startswith(a):
+                    changed = b + changed[len(a):]
+            for i, name in translate("**weekdaynames").items():
+                changed = changed.replace(("**%s]" % i), (name+"]"))
             return changed
         
             
         item.title = req.args.get("title")
         session = db_cnx(self.env)
         session.add(item)
-        changed = "new recording on %s [%s-%s] %s" % (item.channelname,
-                                                      item.newtime,
-                                                      item.endtime,
-                                                      item.title)
+        datespec = "[%s-%s%s]" % (item.newtime, 
+                                item.endtime, 
+                                item.onlydate and " "+item.onlydate or " **%s" % item.weekday 
+                               ) 
+        changed = "new recording on %s %s %s" % (item.channelname,
+                                                 datespec,
+                                                 item.title)
         session.add(RecordingChanges(tablename="RecordingList",
                                   username=req.authname,
                                   modified=datetime.datetime.now(),
         item.status = req.args.get("status")
         item.priority = req.args.get("priority")
         item.title = req.args.get("title")
-        changed = "set recording on %s [%s-%s] %s" % (item.channelname,
-                                                      item.newtime,
-                                                      item.endtime,
-                                                      item.title)
+        state = item.status
+        if state == "ok": state = "next"
+        if not state: state = "some"
+        datespec = "[%s-%s%s]" % (item.newtime, 
+                                item.endtime, 
+                                item.onlydate and " "+item.onlydate or " **%s" % item.weekday 
+                               ) 
+        changed = "set %s recording on %s %s %s" % (state,
+                                                         item.channelname,
+                                                         datespec,
+                                                         item.title)
         session.add(RecordingChanges(tablename="RecordingList",
                                   username=req.authname,
                                   modified=datetime.datetime.now(),

File src/dvbcronrecording/dvbcronrecording.de.po

 msgstr "Recorder-Liste"
 
 msgid "recording list"
-msgstr "Recorder-Liste"
+msgstr "Aufnahmeliste"
 
 msgid "activate!"
 msgstr "Aktivieren!"
 msgstr "Cron Aktivierung"
 
 msgid "Recording List"
-msgstr "Die Recorder-Liste"
+msgstr "Die Aufnahmeliste"
 
 
 # ---------------------------------------------------------
 
 msgid " continues"
 msgstr " weiterlaufend"
+
+msgid "the recording list was activated"
+msgstr "Die Aufnahmeliste wurde aktiviert"
+
+msgid "a recording list entry was modified"
+msgstr "Ein Aufnahmeeintrag wurde verändert"
+ 
+msgid "set next recording on"
+msgstr "Setzte nächste Aufnahme auf"
+
+msgid "set some recording on"
+msgstr "Setzte eine Aufnahme auf"
+
+msgid "set no recording on"
+msgstr "Ohne Aufnahme gesetzt auf"
+
+msgid "ACTIVATE: the modified recordinglist was activated"
+msgstr "AKTIVIERT: die veränderte Aufnahmelist wurde aktiviert"

File src/dvbcronrecording/translate.py

         trans = self.get(msg)
         if kwargs: return trans % kwargs
         return trans
+    def gettext(self, msg):
+        return self.get(msg)
     def get(self, msg, default = None):
         trans = self.t.ugettext(msg)
         if trans in [ msg ] and default is not None: return default