Hi,

Find attached a new patch for i18n support in src/tv directory.

David
diff -Naur freevo-1.4rc4/src/tv/channels.py freevo-1.4rc4_new/src/tv/channels.py
--- freevo-1.4rc4/src/tv/channels.py	2003-11-15 15:58:34.000000000 +0100
+++ freevo-1.4rc4_new/src/tv/channels.py	2003-11-15 15:17:36.000000000 +0100
@@ -131,7 +131,7 @@
                 self.chan_index = pos
 
         if not new_chan:
-            print 'ERROR: Cannot find tuner channel "%s" in the TV channel listing' % chan
+            print _('ERROR: Cannot find tuner channel "%s" in the TV channel listing') % chan
             return
 
         vg = self.getVideoGroup(new_chan)
@@ -178,7 +178,7 @@
                     vd.setfreq_old(freq)
                 vd.close()
             except:
-                print 'Failed to set freq for channel %s' % chan
+                print _('Failed to set freq for channel %s') % chan
 
 
     def getChannel(self):
diff -Naur freevo-1.4rc4/src/tv/edit_favorite.py freevo-1.4rc4_new/src/tv/edit_favorite.py
--- freevo-1.4rc4/src/tv/edit_favorite.py	2003-11-15 15:58:34.000000000 +0100
+++ freevo-1.4rc4_new/src/tv/edit_favorite.py	2003-11-15 15:27:27.000000000 +0100
@@ -99,7 +99,7 @@
             
 
 
-        PopupBox.__init__(self, text='Edit Favorite', left=left, top=top, width=width, 
+        PopupBox.__init__(self, text=_('Edit Favorite'), left=left, top=top, width=width, 
                           height=height)
 
         self.v_spacing = 15
@@ -113,15 +113,15 @@
 
         guide = tv.epg_xmltv.get_guide()
 
-        name = Label('Name:\t', self, Align.LEFT)
+        name = Label(_('Name:\t'), self, Align.LEFT)
         self.name_input = LetterBoxGroup(text=self.fav.name)
         self.name_input.h_align = Align.NONE
         self.add_child(self.name_input)
 
 
-        title = Label('Title:\t%s' % self.fav.title, self, Align.LEFT)
+        title = Label(_('Title:\t%s') % self.fav.title, self, Align.LEFT)
 
-        chan = Label('Channel:\t', self, Align.LEFT)
+        chan = Label(_('Channel:\t'), self, Align.LEFT)
 
         self.chan_box = OptionBox('ANY')
         self.chan_box.h_align = Align.NONE
@@ -139,26 +139,26 @@
         self.chan_box.toggle_selected_index(chan_index)
         self.add_child(self.chan_box)
 
-        dow = Label('Day of Week:\t', self, Align.LEFT)
+        dow = Label(_('Day of Week:\t'), self, Align.LEFT)
         self.dow_box = OptionBox('ANY DAY')
         self.dow_box.h_align = Align.NONE
 
-        self.dow_box.add_item(text='ANY DAY', value='ANY')
-        self.dow_box.add_item(text='Mon', value=0)
-        self.dow_box.add_item(text='Tues', value=1)
-        self.dow_box.add_item(text='Wed', value=2)
-        self.dow_box.add_item(text='Thurs', value=3)
-        self.dow_box.add_item(text='Fri', value=4)
-        self.dow_box.add_item(text='Sat', value=5)
-        self.dow_box.add_item(text='Sun', value=6)
+        self.dow_box.add_item(text=_('ANY DAY'), value='ANY')
+        self.dow_box.add_item(text=_('Mon'), value=0)
+        self.dow_box.add_item(text=_('Tues'), value=1)
+        self.dow_box.add_item(text=_('Wed'), value=2)
+        self.dow_box.add_item(text=_('Thurs'), value=3)
+        self.dow_box.add_item(text=_('Fri'), value=4)
+        self.dow_box.add_item(text=_('Sat'), value=5)
+        self.dow_box.add_item(text=_('Sun'), value=6)
 
         self.dow_box.toggle_selected_index(0)
         self.add_child(self.dow_box)
 
-        tod = Label('Time of Day:\t', self, Align.LEFT)
+        tod = Label(_('Time of Day:\t'), self, Align.LEFT)
         self.tod_box = OptionBox('ANY')
         self.tod_box.h_align = Align.NONE
-        self.tod_box.add_item(text='ANY TIME', value='ANY')
+        self.tod_box.add_item(text=_('ANY TIME'), value='ANY')
         self.tod_box.add_item(text='12:00 AM', value=0)
         self.tod_box.add_item(text='11:30 AM', value=30)
         self.tod_box.add_item(text='1:00 AM', value=60)
@@ -211,7 +211,7 @@
         self.tod_box.toggle_selected_index(0)
         self.add_child(self.tod_box)
 
-        self.save = Button('Save')
+        self.save = Button(_('Save'))
         self.add_child(self.save)
 
 
@@ -335,7 +335,7 @@
                     tv.view_favorites.ViewFavorites(parent=self.parent, text='Favorites').show()
                     self.destroy()
                 else:
-                    AlertBox(parent=self, text='Failed: %s' % msg)
+                    AlertBox(parent=self, text=_('Failed: %s') % msg)
                 return
             elif event in (em.INPUT_LEFT, em.MENU_PAGEUP):
                 self.save.toggle_selected()
diff -Naur freevo-1.4rc4/src/tv/epg_xmltv.py freevo-1.4rc4_new/src/tv/epg_xmltv.py
--- freevo-1.4rc4/src/tv/epg_xmltv.py	2003-11-15 15:58:34.000000000 +0100
+++ freevo-1.4rc4_new/src/tv/epg_xmltv.py	2003-11-15 15:34:59.000000000 +0100
@@ -140,7 +140,7 @@
 TRUE = 1
 FALSE = 0
 
-EPG_TIME_EXC = 'Time conversion error'
+EPG_TIME_EXC = _('Time conversion error')
 
 
 cached_guide = None
@@ -184,18 +184,18 @@
             try:
                 epg_ver = cached_guide.EPG_VERSION
             except AttributeError:
-                print 'EPG does not have a version number, must be reloaded'
+                print _('EPG does not have a version number, must be reloaded')
                 print dir(cached_guide)
 
             if epg_ver != epg_types.EPG_VERSION:
-                print (('EPG version number %s is stale (new is %s), must ' +
-                        'be reloaded') % (epg_ver, epg_types.EPG_VERSION))
+                print ((_('EPG version number %s is stale (new is %s), must ') +
+                        _('be reloaded')) % (epg_ver, epg_types.EPG_VERSION))
 
             elif cached_guide.timestamp != os.path.getmtime(config.XMLTV_FILE):
                 # Hmmm, weird, there is a pickled file newer than the TV.xml
                 # file, but the timestamp in it does not match the TV.xml
                 # timestamp. We need to reload!
-                print 'EPG: Pickled file timestamp mismatch, reloading!'
+                print _('EPG: Pickled file timestamp mismatch, reloading!')
                 
             else:
                 if DEBUG:
@@ -215,7 +215,7 @@
 	    except:
 	    	# Don't violently crash on a incomplete or empty TV.xml please.
 	    	cached_guide = None
-                print "Couldn't load the TV Guide, got an exception!"
+                print _("Couldn't load the TV Guide, got an exception!")
                 print
                 traceback.print_exc()
             else:
@@ -314,7 +314,7 @@
                     c.tunerid = displayname.split()[0]
                 else:
                     c.displayname = displayname
-                    c.tunerid = 'REPLACE WITH TUNERID FOR %s' % displayname
+                    c.tunerid = _('REPLACE WITH TUNERID FOR %s') % displayname
 
             guide.AddChannel(c)
 
diff -Naur freevo-1.4rc4/src/tv/program_search.py freevo-1.4rc4_new/src/tv/program_search.py
--- freevo-1.4rc4/src/tv/program_search.py	2003-11-15 15:58:34.000000000 +0100
+++ freevo-1.4rc4_new/src/tv/program_search.py	2003-11-15 15:44:24.000000000 +0100
@@ -90,7 +90,7 @@
                  bd_width=None, vertical_expansion=1):
 
         if not text:
-            text = 'Program Search'
+            text = _('Program Search')
         
         PopupBox.__init__(self, parent, text, handler, left, top, width, height, 
                           bg_color, fg_color, icon, border, bd_color, bd_width,
@@ -98,7 +98,7 @@
 
         (self.server_available, msg) = record_client.connectionTest()
         if not self.server_available:
-            errormsg = Label('Record server unavailable: %s\n\nFeel free to impliment this function inside the main guide.' % msg, 
+            errormsg = Label(_('Record server unavailable: %s\n\nFeel free to impliment this function inside the main guide.') % msg, 
                              self, Align.CENTER)
             return 
 
@@ -126,7 +126,7 @@
 
     def searchProg(self, find):
         if DEBUG: print 'SEARCHING FOR: %s' % find
-        pop = PopupBox(parent=self, text='Searching, please wait...')
+        pop = PopupBox(parent=self, text=_('Searching, please wait...'))
         pop.show()
 
         (result, matches) = record_client.findMatches(find)
diff -Naur freevo-1.4rc4/src/tv/record_client.py freevo-1.4rc4_new/src/tv/record_client.py
--- freevo-1.4rc4/src/tv/record_client.py	2003-11-15 15:58:34.000000000 +0100
+++ freevo-1.4rc4_new/src/tv/record_client.py	2003-11-15 15:47:58.000000000 +0100
@@ -68,7 +68,7 @@
     try: 
         (status, message) = server.getScheduledRecordings()
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return returnFromJelly(status, message)
 
@@ -77,7 +77,7 @@
     try:
         (status, message) = server.saveScheduledRecordings(scheduledRecordings)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message)
 
@@ -86,35 +86,35 @@
     try:
         (status, message) = server.echotest(teststr)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message)
 
 
 def scheduleRecording(prog=None):
     if not prog:
-        return (FALSE, 'no prog')
+        return (FALSE, _('no prog'))
 
     if prog.stop < time.time():
-        return (FALSE, 'ERROR: cannot record it if it is over')
+        return (FALSE, _('ERROR: cannot record it if it is over'))
         
     try:
         (status, message) = server.scheduleRecording(marmalade.jellyToXML(prog))
     except:
         traceback.print_exc()
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message)
 
 
 def removeScheduledRecording(prog=None):
     if not prog:
-        return (FLASE, 'no prog')
+        return (FLASE, _('no prog'))
 
     try:
         (status, message) = server.removeScheduledRecording(marmalade.jellyToXML(prog))
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message)
 
@@ -123,7 +123,7 @@
     try:
         (status, message) = server.cleanScheduledRecordings()
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message)
 
@@ -131,19 +131,19 @@
 def isProgScheduled(prog, schedule=None):
     if schedule or schedule == {}:
         if schedule == {}:
-            return (FALSE, 'prog not scheduled')
+            return (FALSE, _('prog not scheduled'))
 
         for me in schedule.values():
             if me.start == prog.start and me.channel_id == prog.channel_id:
-                return (TRUE, 'prog is scheduled')
+                return (TRUE, _('prog is scheduled'))
 
-        return (FALSE, 'prog not scheduled')
+        return (FALSE, _('prog not scheduled'))
     else:
         try:
             (status, message) = server.isProgScheduled(marmalade.jellyToXML(prog), 
                                                        schedule)
         except:
-            return (FALSE, 'record_client: connection error')
+            return (FALSE, _('record_client: connection error'))
 
         return (status, message) 
     
@@ -152,7 +152,7 @@
     try:
         (status, response) = server.findProg(chan, start)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
 
     return returnFromJelly(status, response)
@@ -162,7 +162,7 @@
     try:
         (status, response) = server.findMatches(find)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return returnFromJelly(status, response)
 
@@ -171,7 +171,7 @@
     try:
         (status, message) = server.addFavorite(name, prog, exactchan, exactdow, exacttod)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message) 
 
@@ -180,7 +180,7 @@
     try:
         (status, message) = server.addEditedFavorite(name, title, chan, dow, mod, priority)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message) 
 
@@ -189,7 +189,7 @@
     try:
         (status, message) = server.removeFavorite(name)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message) 
 
@@ -198,7 +198,7 @@
     try:
         (status, message) = server.clearFavorites()
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message) 
 
@@ -207,7 +207,7 @@
     try:
         (status, response) = server.getFavorites()
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
 
     return returnFromJelly(status, response)
@@ -217,7 +217,7 @@
     try:
         (status, response) = server.getFavorite(name)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
 
     return returnFromJelly(status, response)
@@ -227,7 +227,7 @@
     try:
         (status, message) = server.adjustPriority(favname, mod)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message) 
 
@@ -237,7 +237,7 @@
         (status, message) = server.isProgAFavorite(marmalade.jellyToXML(prog), 
                                                    marmalade.jellyToXML(favs))
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message) 
 
@@ -246,7 +246,7 @@
     try:
         (status, message) = server.removeFavoriteFromSchedule(fav)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message) 
 
@@ -255,7 +255,7 @@
     try:
         (status, message) = server.addFavoriteToSchedule(fav)
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message) 
 
@@ -264,7 +264,7 @@
     try:
         (status, message) = server.updateFavoritesSchedule()
     except:
-        return (FALSE, 'record_client: connection error')
+        return (FALSE, _('record_client: connection error'))
 
     return (status, message) 
 
diff -Naur freevo-1.4rc4/src/tv/tvguide.py freevo-1.4rc4_new/src/tv/tvguide.py
--- freevo-1.4rc4/src/tv/tvguide.py	2003-11-15 15:58:34.000000000 +0100
+++ freevo-1.4rc4_new/src/tv/tvguide.py	2003-11-15 15:54:11.000000000 +0100
@@ -201,8 +201,8 @@
             if os.path.exists(tvlockfile):
                 # XXX: In the future add the options to watch what we are
                 #      recording or cencel it and watch TV.
-                AlertBox(text='Sorry, you cannot watch TV while recording. '+ \
-                              'If this is not true then remove ' + \
+                AlertBox(text=_('Sorry, you cannot watch TV while recording. ')+ \
+                              _('If this is not true then remove ') + \
                               tvlockfile + '.', height=200).show()
                 return TRUE
 
diff -Naur freevo-1.4rc4/src/tv/view_favorites.py freevo-1.4rc4_new/src/tv/view_favorites.py
--- freevo-1.4rc4/src/tv/view_favorites.py	2003-11-15 15:58:34.000000000 +0100
+++ freevo-1.4rc4_new/src/tv/view_favorites.py	2003-11-15 15:56:52.000000000 +0100
@@ -77,20 +77,20 @@
                  bd_width=None):
 
         if not text:
-            text = 'View Favorites'
+            text = _('View Favorites')
         
         PopupBox.__init__(self, parent, text, handler, left, top, width, height, 
                           bg_color, fg_color, icon, border, bd_color, bd_width)
 
         (self.server_available, msg) = record_client.connectionTest()
         if not self.server_available:
-            errormsg = Label('Record server unavailable: %s' % msg, 
+            errormsg = Label(_('Record server unavailable: %s') % msg, 
                              self, Align.CENTER)
             return 
 
         self.internal_h_align = Align.CENTER
 
-        legend = Label('Name\tTitle\tChannel\tDOW\tTOD', self, Align.CENTER)
+        legend = Label(_('Name\tTitle\tChannel\tDOW\tTOD'), self, Align.CENTER)
 
         items_height = 40
         self.num_shown_items = 7

Reply via email to