Path: csiph.com!usenet.pasdenom.info!aioe.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices] Date: Tue, 03 Mar 2015 23:35:13 +1300 Lines: 71 Message-ID: References: <87ioem8ftg.fsf@elektro.pacujo.net> <54f2c9c6$0$12991$c3e8da3$5496439d@news.astraweb.com> <8761ak7kxm.fsf@elektro.pacujo.net> <87sido6491.fsf@elektro.pacujo.net> <6d6033b8-d228-4f5f-ac68-ae5b2a226431@googlegroups.com> <87d24regm6.fsf@elektro.pacujo.net> <54f4763c$0$12979$c3e8da3$5496439d@news.astraweb.com> <87zj7ud0i1.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net ToZNrd+vZIX9amE1W8/gsQmHeoK/Q/mtz3VzSKIs8iVLXgkoFk Cancel-Lock: sha1:Ke8lrJyccKQdvk6boYw+DhRvAus= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:86834 Chris Angelico wrote: > And I've seen a number of proposals to build Python with its > *keywords* localized. While there is a reasonable limit to this (for > instance, I wouldn't expect the disassembly of CPython byte-code to > have "STORE_FAST" translated into another language), there's nothing > wrong with programmers being able to write their code in their > languages. Just for fun, I used Google Translate to turn a piece of my Python code into French. Some of the results were rather amusing. For example, it turned "mess" (short for "message") into "désordre", and "but" (short for "button") into "mais". It got "for", "in", "if", "else" and "return" right, though! # Original code def ask(mess, responses = ["OK", "Cancel"], default = 0, cancel = -1, wrap_width = 60, **kwds): box = Dialog(**kwds) d = box.margin lb = wrapped_label(mess, wrap_width) lb.topleft = (d, d) buts = [] for caption in responses: but = Button(caption, action = lambda x = caption: box.dismiss(x)) buts.append(but) brow = Row(buts, spacing = d, equalize = 'w') lb.width = max(lb.width, brow.width) col = Column([lb, brow], spacing = d, align ='r') col.topleft = (d, d) if default is not None: box.enter_response = responses[default] else: box.enter_response = None if cancel is not None: box.cancel_response = responses[cancel] else: box.cancel_response = None box.add(col) box.shrink_wrap() return box.present() # Translated code demander def (désordre, réponses = ["OK", "Annuler"], par défaut = 0, annulent = -1, wrap_width = 60, kwds **): boîte de dialogue = (** kwds) d = box.margin lb = wrapped_label (désordre, wrap_width) lb.topleft = (d, d) BUTS = [] pour la légende dans les réponses: mais = Bouton (légende, action = lambda x = légende: box.dismiss (x)) buts.append (mais) Brow = ROW (buts, l'espacement = d, égalisent = 'W') lb.width = max (lb.width, brow.width) col = Colonne ([lb, le front], l'espacement = d, align = 'r') col.topleft = (d, d) si par défaut ne est pas None: box.enter_response = réponses [défaut] d'autre: box.enter_response = Aucun si annuler ne est pas None: box.cancel_response = réponses [Annuler] d'autre: box.cancel_response = Aucun box.add (col) box.shrink_wrap () retourner box.present ()