On Fri, May 24, 2019 at 7:47 PM Andre Roberge <andre.robe...@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!

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.

- Tal Einat
_______________________________________________
IDLE-dev mailing list
IDLE-dev@python.org
https://mail.python.org/mailman/listinfo/idle-dev

Reply via email to