[Idle-dev] Forking Idle - translating menus, etc.

Andre Roberge andre.roberge at gmail.com
Fri May 24 16:21:05 EDT 2019

On Fri, May 24, 2019 at 4:16 PM Tal Einat <taleinat at gmail.com> wrote:

> On Fri, May 24, 2019 at 7:47 PM Andre Roberge <andre.roberge at gmail.com>
> wrote:
> >
> > I'll try a few things on my own and, if I find something that seems
> reasonable, I will indicate it on this list.
> >
> Some things to consider when working on this:
> 1. There are a few places in the code that alter the menus, removing
> and/or adding items. One example is in Lib/idlelib/macosx.py, which
> makes macOS-specific adjustments. I think the other examples have been
> refactored by now, but some 3rd party extensions also add items to
> menus. Therefore, when translating, try to translate the OS-specific
> menu items which aren't defined in Lib/idlelib/mainmenu.py, but more
> importantly, make sure to fall back to the English texts when no
> translation is available
> 2. Besides underscores (_) for the keyboard shortcuts, the menu labels
> can also contain an exclamation mark (!) to mark an item as a boolean
> flag. There's a function named prepstr() in Lib/idlelib/editor.py that
> returns menu labels without the underscores, but it doesn't remove the
> boolean flag marks! Here's a little helper function to get the actual
> displayed text, which would then need to be translated:
> def get_menuitem_display_text(menuitem):
>     label, _event = menuitem
>     label_noflag = label[1:] if label[0] == '!' else label
>     _underscore, display_text = prepstr(label_noflag)
>     return display_text
> The code that currently does this is somewhere deep inside editor.py;
> make sure not to miss it!

I had noticed it - but I didn't see any item that ended with a !.
(And I completely overlooked the MacOS stuff).
 I've had to take a bit of a crash course in Idle's code to get my hack to

> Please feel free to contact me directly if you have any technical
> questions; I know this code rather well and I'm happy to help.

Thank you.

André Roberge

> - Tal Einat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/idle-dev/attachments/20190524/b29ab2e1/attachment.html>

More information about the IDLE-dev mailing list