[Python-ideas] Non-English names in the turtle module.
Chris Angelico
rosuav at gmail.com
Fri Sep 4 04:43:38 CEST 2015
On Fri, Sep 4, 2015 at 12:34 PM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Chris Angelico writes:
>
> > +1. These modules could simply import a boatload of stuff from
> > "turtle" under new names, which would make them fairly slim. Question:
> > Should they start with "from turtle import *" so the English names are
> > always available? It'd ensure that untranslated names don't get missed
> > out, but it might be confusing.
>
> That would be pretty horrible, and contrary to the point of allowing
> the new user to learn algorithmic thinking in a small world using
> intuitively named commands.
>
> I would think the sensible thing to do is to is invite participation
> from traditional translation volunteers with something like
>
> import turtle
> from i18n import _
> _translations = { 'turtle' : _('turtle'), ... }
> for name in dir(turtle):
> if name in _translations:
> eval("from turtle import {} as {}".format(name, _translations[name]))
> elif english_fallbacks_please:
> eval("from turtle import {}".format(name))
Yeah, that'd be better than including all the original English names.
And _translations can be generated easily enough:
import turtle
print("{" + ", ".join("%r: _(%r)" % (n, n) for n in dir(turtle)) + "}")
Though the diffs would be disgusting any time anything in turtle changes.
ChrisA
More information about the Python-ideas
mailing list