(original) (raw)

diff -r 193e7ad92900 Lib/idlelib/Bindings.py --- a/Lib/idlelib/Bindings.py Mon Apr 15 11:59:35 2013 +0100 +++ b/Lib/idlelib/Bindings.py Wed Apr 17 16:00:54 2013 +0200 @@ -12,72 +12,74 @@ from idlelib.configHandler import idleConf from idlelib import macosxSupport +from idle_i18n import _ + menudefs = [ # underscore prefixes character to underscore ('file', [ - ('_New Window', '<>'), - ('_Open...', '<>'), - ('Open _Module...', '<>'), - ('Class _Browser', '<>'), - ('_Path Browser', '<>'), + (_('_New Window'), '<>'), + (_('_Open...'), '<>'), + (_('Open _Module...'), '<>'), + (_('Class _Browser'), '<>'), + (_('_Path Browser'), '<>'), None, - ('_Save', '<>'), - ('Save _As...', '<>'), - ('Save Cop_y As...', '<>'), + (_('_Save'), '<>'), + (_('Save _As...'), '<>'), + (_('Save Cop_y As...'), '<>'), None, - ('Prin_t Window', '<>'), + (_('Prin_t Window'), '<>'), None, - ('_Close', '<>'), - ('E_xit', '<>'), + (_('_Close'), '<>'), + (_('E_xit'), '<>'), ]), ('edit', [ - ('_Undo', '<>'), - ('_Redo', '<>'), + (_('_Undo'), '<>'), + (_('_Redo'), '<>'), None, - ('Cu_t', '<>'), - ('_Copy', '<>'), - ('_Paste', '<>'), - ('Select _All', '<>'), + (_('Cu_t'), '<>'), + (_('_Copy'), '<>'), + (_('_Paste'), '<>'), + (_('Select _All'), '<>'), None, - ('_Find...', '<>'), - ('Find A_gain', '<>'), - ('Find _Selection', '<>'), - ('Find in Files...', '<>'), - ('R_eplace...', '<>'), - ('Go to _Line', '<>'), + (_('_Find...'), '<>'), + (_('Find A_gain'), '<>'), + (_('Find _Selection'), '<>'), + (_('Find in Files...'), '<>'), + (_('R_eplace...'), '<>'), + (_('Go to _Line'), '<>'), ]), ('format', [ - ('_Indent Region', '<>'), - ('_Dedent Region', '<>'), - ('Comment _Out Region', '<>'), - ('U_ncomment Region', '<>'), - ('Tabify Region', '<>'), - ('Untabify Region', '<>'), - ('Toggle Tabs', '<>'), - ('New Indent Width', '<>'), + (_('_Indent Region'), '<>'), + (_('_Dedent Region'), '<>'), + (_('Comment _Out Region'), '<>'), + (_('U_ncomment Region'), '<>'), + (_('Tabify Region'), '<>'), + (_('Untabify Region'), '<>'), + (_('Toggle Tabs'), '<>'), + (_('New Indent Width'), '<>'), ]), ('run', [ - ('Python Shell', '<>'), + (_('Python Shell'), '<>'), ]), ('shell', [ - ('_View Last Restart', '<>'), - ('_Restart Shell', '<>'), + (_('_View Last Restart'), '<>'), + (_('_Restart Shell'), '<>'), ]), ('debug', [ - ('_Go to File/Line', '<>'), - ('!_Debugger', '<>'), - ('_Stack Viewer', '<>'), - ('!_Auto-open Stack Viewer', '<>'), + (_('_Go to File/Line'), '<>'), + (_('!_Debugger'), '<>'), + (_('_Stack Viewer'), '<>'), + (_('!_Auto-open Stack Viewer'), '<>'), ]), ('options', [ - ('_Configure IDLE...', '<>'), + (_('_Configure IDLE...'), '<>'), None, ]), ('help', [ - ('_About IDLE', '<>'), + (_('_About IDLE'), '<>'), None, - ('_IDLE Help', '<>'), - ('Python _Docs', '<>'), + (_('_IDLE Help'), '<>'), + (_('Python _Docs'), '<>'), ]), ] diff -r 193e7ad92900 Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py Mon Apr 15 11:59:35 2013 +0100 +++ b/Lib/idlelib/PyShell.py Wed Apr 17 16:00:54 2013 +0200 @@ -18,6 +18,8 @@ from code import InteractiveInterpreter from platform import python_version +from idle_i18n import _ + try: from tkinter import * except ImportError: @@ -120,12 +122,12 @@ self.restore_file_breaks() rmenu_specs = [ - ("Cut", "<>", "rmenu_check_cut"), - ("Copy", "<>", "rmenu_check_copy"), - ("Paste", "<>", "rmenu_check_paste"), + (_("Cut"), "<>", "rmenu_check_cut"), + (_("Copy"), "<>", "rmenu_check_copy"), + (_("Paste"), "<>", "rmenu_check_paste"), (None, None, None), - ("Set Breakpoint", "<>", None), - ("Clear Breakpoint", "<>", None) + (_("Set Breakpoint"), "<>", None), + (_("Clear Breakpoint"), "<>", None) ] def set_breakpoint(self, lineno): @@ -813,17 +815,17 @@ # Override menus menu_specs = [ - ("file", "_File"), - ("edit", "_Edit"), - ("debug", "_Debug"), - ("options", "_Options"), - ("windows", "_Windows"), - ("help", "_Help"), + ("file", _("_File")), + ("edit", _("_Edit")), + ("debug", _("_Debug")), + ("options", _("_Options")), + ("windows", _("_Windows")), + ("help", _("_Help")), ] if macosxSupport.runningAsOSXApp(): del menu_specs[-3] - menu_specs[-2] = ("windows", "_Window") + menu_specs[-2] = ("windows", _("_Window")) # New classes diff -r 193e7ad92900 Lib/idlelib/idle_i18n.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/idlelib/idle_i18n.py Wed Apr 17 16:00:54 2013 +0200 @@ -0,0 +1,4 @@ +import gettext +gettext.bindtextdomain('idlelib') +gettext.textdomain('idlelib') +_ = gettext.gettext