This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Al.Sweigart, Todd.Rovito, ezio.melotti, mariedam, ned.deily, olberger, pitrou, roger.serwy, terry.reedy
Date 2017-10-14.21:26:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1508016372.63.0.213398074469.issue17776@psf.upfronthosting.co.za>
In-reply-to
Content
In the last few months, configdialog has been refactored to have a class for each settings tab.  This makes it easier to revise and add new options, such as 'menu language'.

With this done, the IDLE features implemented as (optional) extensions were turned into normal features.  Non-key option settings were moved to the General tab. The menu items were moved to mainmenu.py.  Having everything in one place should make translation easier.  When making further menu system changes, I will keep I18n in mind.

AFAIK, there is no runtime need to have 60+translation calls in the invisible mainmenu.menudefs structure, which would make it harder to read.  I would rather change the 'label=name' option in menu item insertion calls to 'label=_(name)' or 'label=gettext(name)' or possibly 'label=trandict[name].  In macosx the explicit "label='window'" would need the same change.  So would the scattered context menu insertion calls.

Just for translating the menu, gettext seems possibly like overkill.  I remain reluctance to use it without my questions above answered.  Another question: can the automatic selection mechanism be overridden by the user?

All that is needed is a simple template file that creates a translation dictionary  I think translation would be easiest if the template preserved both the order and hierarchical structure.  It would be trivial to write a function to create a full version of the following.

trandict = {
    'file': 
        '_New File':
        ...
    ...
}
[Note: top level names like 'file' are lowercased in menudefs but then capitalized in the menu.  Maybe they should be uppercased to start with.]

The output instead could match what whatever the gettext machinery requires.  I don't know if the gettext extractor preserves the order, but I am sure it will not preserve the structure.

Recently, translations were added to the official doc site.  A translation of the IDLE section should have a good-enough translation of the menu that can be extracted into a dict for IDLE.  The only problem is that they will not have the underscores for hot keys.  I don't know if these are universally used.

The Japanese translation includes the IDLE section.  The top level names (File, Edit, ... Help) are not tranlated.  Perhaps the team felt that such terms should be familiar enough to Japanese users to not need translation.  The dropdown menu labels *are* translated, but keep the English, as in
'New File [新規ファイル]'.     In any case, this is enough for experiments.
History
Date User Action Args
2017-10-14 21:26:12terry.reedysetrecipients: + terry.reedy, pitrou, ned.deily, ezio.melotti, roger.serwy, Todd.Rovito, Al.Sweigart, olberger, mariedam
2017-10-14 21:26:12terry.reedysetmessageid: <1508016372.63.0.213398074469.issue17776@psf.upfronthosting.co.za>
2017-10-14 21:26:12terry.reedylinkissue17776 messages
2017-10-14 21:26:11terry.reedycreate