@@ -85,14 +85,14 @@ def formatvalue(self, value):
8585
8686
8787class ExceptionDialog (gtk .MessageDialog ):
88- def __init__ (self , exc_type , exc_value , tb , text = 'An error occurred.' ):
88+ def __init__ (self , exc_type , exc_value , tb , text = _ ( 'An error occurred.' ) ):
8989 gtk .MessageDialog .__init__ (self , buttons = gtk .BUTTONS_CLOSE ,
9090 type = gtk .MESSAGE_ERROR ,
9191 message_format = text )
9292 self .set_resizable (True )
9393 import cgitb
9494 text = cgitb .text ((exc_type , exc_value , tb ), 5 )
95- expander = gtk .Expander ('Exception details' )
95+ expander = gtk .Expander (_ ( 'Exception details' ) )
9696 self .vbox .pack_start (expander )
9797 textview = gtk .TextView ()
9898 textview .get_buffer ().set_text (text )
@@ -108,7 +108,7 @@ class ExceptionManager(object):
108108 the exception's type, value, a traceback and a text to display as
109109 arguments.
110110 """
111- def __init__ (self , DialogType , text = 'An error occurred.' ):
111+ def __init__ (self , DialogType , text = _ ( 'An error occurred.' ) ):
112112 self .DialogType = DialogType
113113 self .text = text
114114
@@ -144,7 +144,7 @@ class Statusbar(gtk.Statusbar):
144144 """Contains feedback messages"""
145145 def __init__ (self ):
146146 gtk .Statusbar .__init__ (self )
147- self .context_id = self .get_context_id ('Statusbar' )
147+ self .context_id = self .get_context_id (_ ( 'Statusbar' ) )
148148
149149 def message (self , s , n = 3 ):
150150 self .clear ()
@@ -221,7 +221,7 @@ def do_expose_event(self, event):
221221 width , height = self .get_size ()
222222 self .style .paint_flat_box (self .window , gtk .STATE_NORMAL ,
223223 gtk .SHADOW_OUT , None , self ,
224- 'tooltip' , 0 , 0 , width , height )
224+ _ ( 'tooltip' ) , 0 , 0 , width , height )
225225 gtk .Window .do_expose_event (self , event )
226226
227227 def forward (self ):
@@ -290,7 +290,7 @@ def confirm(self, q):
290290 return response == gtk .RESPONSE_YES
291291
292292 def file_prompt (self , s ):
293- chooser = gtk .FileChooserDialog (title = "File to save to" ,
293+ chooser = gtk .FileChooserDialog (title = _ ( "File to save to" ) ,
294294 action = gtk .FILE_CHOOSER_ACTION_SAVE ,
295295 buttons = (gtk .STOCK_CANCEL ,
296296 gtk .RESPONSE_CANCEL ,
@@ -301,12 +301,12 @@ def file_prompt(self, s):
301301 chooser .set_current_folder (os .path .expanduser ('~' ))
302302
303303 pyfilter = gtk .FileFilter ()
304- pyfilter .set_name ("Python files" )
304+ pyfilter .set_name (_ ( "Python files" ) )
305305 pyfilter .add_pattern ("*.py" )
306306 chooser .add_filter (pyfilter )
307307
308308 allfilter = gtk .FileFilter ()
309- allfilter .set_name ("All files" )
309+ allfilter .set_name (_ ( "All files" ) )
310310 allfilter .add_pattern ("*" )
311311 chooser .add_filter (allfilter )
312312
@@ -477,7 +477,7 @@ def do_key_press_event(self, event):
477477 show_source_in_new_window (source , self .config .color_gtk_scheme ,
478478 self .config .syntax )
479479 else :
480- self .interact .notify ('Cannot show source.' )
480+ self .interact .notify (_ ( 'Cannot show source.' ) )
481481 elif event .keyval == gtk .keysyms .Return :
482482 if self .list_win_visible :
483483 self .list_win_visible = False
@@ -766,10 +766,10 @@ def main(args=None):
766766
767767 setlocale (LC_ALL , '' )
768768
769- gtk_options = ('gtk-specific options' ,
770- "Options specific to bpython's Gtk+ front end" ,
769+ gtk_options = (_ ( 'gtk-specific options' ) ,
770+ _ ( "Options specific to bpython's Gtk+ front end" ) ,
771771 [optparse .Option ('--socket-id' , dest = 'socket_id' ,
772- type = 'int' , help = 'Embed bpython' )])
772+ type = 'int' , help = _ ( 'Embed bpython' ) )])
773773 config , options , exec_args = bpython .args .parse (args , gtk_options ,
774774 True )
775775
@@ -825,7 +825,7 @@ def main(args=None):
825825 pastebin .connect ("activate" , repl_widget .do_paste )
826826 filemenu .append (pastebin )
827827
828- pastebin_partial = gtk .MenuItem ("Pastebin selection" )
828+ pastebin_partial = gtk .MenuItem (_ ( "Pastebin selection" ) )
829829 pastebin_partial .connect ("activate" , repl_widget .do_partial_paste )
830830 filemenu .append (pastebin_partial )
831831
0 commit comments