gettextify pyfpdb/GuiLogView.py

This commit is contained in:
steffen123 2010-08-15 18:43:30 +02:00
parent 680f735007
commit 33257f5a3f

View File

@ -30,6 +30,9 @@ import logging
# logging has been set up in fpdb.py or HUD_main.py, use their settings: # logging has been set up in fpdb.py or HUD_main.py, use their settings:
log = logging.getLogger("logview") log = logging.getLogger("logview")
import gettext
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
trans.install()
MAX_LINES = 100000 # max lines to display in window MAX_LINES = 100000 # max lines to display in window
EST_CHARS_PER_LINE = 150 # used to guesstimate number of lines in log file EST_CHARS_PER_LINE = 150 # used to guesstimate number of lines in log file
@ -47,7 +50,7 @@ class GuiLogView:
self.closeq = closeq self.closeq = closeq
self.logfile = os.path.join(self.config.dir_log, LOGFILES[1][1]) self.logfile = os.path.join(self.config.dir_log, LOGFILES[1][1])
self.dia = gtk.Dialog(title="Log Messages" self.dia = gtk.Dialog(title=_("Log Messages")
,parent=None ,parent=None
,flags=gtk.DIALOG_DESTROY_WITH_PARENT ,flags=gtk.DIALOG_DESTROY_WITH_PARENT
,buttons=(gtk.STOCK_CLOSE,gtk.RESPONSE_OK)) ,buttons=(gtk.STOCK_CLOSE,gtk.RESPONSE_OK))
@ -82,7 +85,7 @@ class GuiLogView:
rb.set_active(logf[2]) rb.set_active(logf[2])
rb.connect('clicked', self.__set_logfile, logf[0]) rb.connect('clicked', self.__set_logfile, logf[0])
hb.pack_start(rb, False, False, 3) hb.pack_start(rb, False, False, 3)
refreshbutton = gtk.Button("Refresh") refreshbutton = gtk.Button(_("Refresh"))
refreshbutton.connect("clicked", self.refresh, None) refreshbutton.connect("clicked", self.refresh, None)
hb.pack_start(refreshbutton, False, False, 3) hb.pack_start(refreshbutton, False, False, 3)
refreshbutton.show() refreshbutton.show()
@ -186,7 +189,7 @@ class GuiLogView:
# to turn indicator off for other cols # to turn indicator off for other cols
except: except:
err = traceback.extract_tb(sys.exc_info()[2]) err = traceback.extract_tb(sys.exc_info()[2])
print "***sortCols error: " + str(sys.exc_info()[1]) print _("***sortCols error: ") + str(sys.exc_info()[1])
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] ) print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
def refresh(self, widget, data): def refresh(self, widget, data):
@ -199,12 +202,12 @@ if __name__=="__main__":
config = Configuration.Config() config = Configuration.Config()
win = gtk.Window(gtk.WINDOW_TOPLEVEL) win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.set_title("Test Log Viewer") win.set_title(_("Test Log Viewer"))
win.set_border_width(1) win.set_border_width(1)
win.set_default_size(600, 500) win.set_default_size(600, 500)
win.set_resizable(True) win.set_resizable(True)
dia = gtk.Dialog("Log Viewer", dia = gtk.Dialog(_("Log Viewer"),
win, win,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_CLOSE, gtk.RESPONSE_OK)) (gtk.STOCK_CLOSE, gtk.RESPONSE_OK))