Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85386 > unrolled thread

Please help.

Started bychimex60@gmail.com
First post2015-02-09 18:43 +0100
Last post2015-02-10 10:59 +1100
Articles 5 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Please help. chimex60@gmail.com - 2015-02-09 18:43 +0100
    Re: Please help. John Ladasky <john_ladasky@sbcglobal.net> - 2015-02-09 10:08 -0800
      Re: Please help. Dave Angel <d@davea.name> - 2015-02-09 13:25 -0500
        Re: Please help. John Ladasky <john_ladasky@sbcglobal.net> - 2015-02-09 11:06 -0800
    Re: Please help. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-10 10:59 +1100

#85386 — Please help.

Fromchimex60@gmail.com
Date2015-02-09 18:43 +0100
SubjectPlease help.
Message-ID<mailman.18570.1423503843.18130.python-list@python.org>
<html><head><meta http-equiv="Content-Type" content="text/plain;"><style> body {  font-family: "Calibri","Slate Pro","sans-serif"; color:#262626 }</style> </head> <body data-blackberry-caret-color="#00a8df" style=""><div><span style="font-family: Calibri, 'Slate Pro', sans-serif;">‎Hello. Am trying to change the key words to my tribal language. Eg change English language: print() to igbo language: de(). I have been stuck for months I need a mentor or someone that can guide me and answer some of my questions when I get stuck. Thanks..</span></div><div>I will really appreciate it if someone attends to me.</div></body></html>

[toc] | [next] | [standalone]


#85388

FromJohn Ladasky <john_ladasky@sbcglobal.net>
Date2015-02-09 10:08 -0800
Message-ID<ff0a15e0-8d30-4d56-b28a-7d92a99e7d6c@googlegroups.com>
In reply to#85386
On Monday, February 9, 2015 at 9:44:16 AM UTC-8, chim...@gmail.com wrote:
> Hello. Am trying to change the key words to my tribal language. Eg change English language: print() to igbo language: de(). I have been stuck for months I need a mentor or someone that can guide me and answer some of my questions when I get stuck. Thanks..
> I will really appreciate it if someone attends to me.


In Python, functions are bound to names, exactly like other variables are.  You can bind any new name you want to an existing function, like this:

Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("English")
English
>>> de = print
>>> de("Igbo")
Igbo
>>> print("Both function names work")
Both function names work
>>> de("Both function names work")
Both function names work


Hope that helps you.

[toc] | [prev] | [next] | [standalone]


#85391

FromDave Angel <d@davea.name>
Date2015-02-09 13:25 -0500
Message-ID<mailman.18572.1423506358.18130.python-list@python.org>
In reply to#85388
On 02/09/2015 01:08 PM, John Ladasky wrote:
> On Monday, February 9, 2015 at 9:44:16 AM UTC-8, chim...@gmail.com wrote:
>> Hello. Am trying to change the key words to my tribal language. Eg change English language: print() to igbo language: de(). I have been stuck for months I need a mentor or someone that can guide me and answer some of my questions when I get stuck. Thanks..
>> I will really appreciate it if someone attends to me.
>
>
> In Python, functions are bound to names, exactly like other variables are.  You can bind any new name you want to an existing function, like this:
>
> Python 3.4.0 (default, Apr 11 2014, 13:05:11)
> [GCC 4.8.2] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> print("English")
> English
>>>> de = print
>>>> de("Igbo")
> Igbo
>>>> print("Both function names work")
> Both function names work
>>>> de("Both function names work")
> Both function names work
>
>
> Hope that helps you.
>

That will help him with the functions.  But not with the keywords.  The 
OP didn't specify Python version, but in 3.x, print() is a function, and 
can be rebound.  Since he said keyword, he's either mistaken, or he's 
running 2.x

But any real keywords, are a real problem.  For example, changing 'if' 
to some other string.

And all the library code is a problem, as they have to be individually 
translated.  And many of them are not fully in Python, but have C portions.

Then there's the return strings for exceptions, and file names for imports.

And the documentation, and the inline documentation, and reflection.

Many problems, no good solutions.  It has been considered many times by 
many good Python developers, and no reasonable solution has presented 
itself.

When I use grep at the bash command line, do I want these translated to 
English words.  Nope.  They both are acronyms, but few people know what 
they actually stand for.

I wish there were an answer, but I don't think so, other than using a 
non-language (like Esperanto) to pick all the keywords and library 
functions of a new language in.  Then that new language would be equally 
hard for all nationalities to learn.

http://legacy.python.org/workshops/1997-10/proceedings/loewis.html

http://grokbase.com/t/python/python-list/09bsr7hjwh/python-statements-keyword-localization



-- 
DaveA

[toc] | [prev] | [next] | [standalone]


#85392

FromJohn Ladasky <john_ladasky@sbcglobal.net>
Date2015-02-09 11:06 -0800
Message-ID<0f4bf4c1-c87e-46dc-bd92-00ab0d599a93@googlegroups.com>
In reply to#85391
On Monday, February 9, 2015 at 10:26:47 AM UTC-8, Dave Angel wrote:

> That will help him with the functions.  But not with the keywords.  The 
> OP didn't specify Python version, but in 3.x, print() is a function, and 
> can be rebound.  Since he said keyword, he's either mistaken, or he's 
> running 2.x
> 
> But any real keywords, are a real problem.  For example, changing 'if' 
> to some other string.

That's true, Dave, he did say "key words".  I only helped him with his example of a Python built-in function.  And you're right, shadowing key words is currently not possible.

Are you familiar with a program known as a "talk filter"?  They've been around for decades.  

http://www.hyperrealm.com/talkfilters/talkfilters.html

Talk filters are usually used for off-color humor, rather than for serious purposes.  A talk filter processes a text stream, line-by-line, typically in a chat room setting.  A dictionary of words, and their replacements, is defined.  

I could see a talk filter being used to translate a non-English version of Python into standard English Python code.  I suppose that a hook for a talk filter could be added to the interpreter itself.  It wouldn't be easy to change word order to accommodate the syntax of another language, but words themselves could be altered.

[toc] | [prev] | [next] | [standalone]


#85412

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2015-02-10 10:59 +1100
Message-ID<54d949d3$0$12990$c3e8da3$5496439d@news.astraweb.com>
In reply to#85386
Hello Chimex, and welcome.

First, before I answer your question, I have a favour to ask. Please adjust
your email program to send Plain Text as well as (or even instead of)
so-called "Rich Text". When you send Rich Text, many people here will see
your email like this:

chimex60@gmail.com wrote:

> <html><head><meta http-equiv="Content-Type" content="text/plain;"><style>
> body {  font-family: "Calibri","Slate Pro","sans-serif"; color:#262626
> }</style> </head> <body data-blackberry-caret-color="#00a8df"
> style=""><div><span style="font-family: Calibri, 'Slate Pro',
> sans-serif;">‎Hello. Am trying to change the key words to my tribal
> language. Eg change English language: print() to igbo language: de(). I
> have been stuck for months I need a mentor or someone that can guide me
> and answer some of my questions when I get stuck.
> Thanks..</span></div><div>I will really appreciate it if someone attends
> to me.</div></body></html>

I hope you understand why most people won't bother to try to read or respond
to such a mess. So-called "Rich Text" (actually HTML) bloats your email,
making it bigger and slower than it needs to be, and it can be a security
threat to the receiver (unscrupulous people can insert hostile code in the
HTML, or web bugs, or other nasties). Or worse, it means that we're stuck
with reading people's messages in some unspeakably horrible combination of
ugly fonts, clashing colours and dancing fairies dancing across the page.
So please understand that especially on a technical forum like this,
probably 90% of of people will respond poorly to anything written in Rich
Text alone.

Moving on to your actual question:

    Am trying to change the key words to my tribal
    language. Eg change English language: print() to 
    igbo language: de().

I know of two projects that do the same thing, ChinesePython and Teuton.


http://www.chinesepython.org/

http://reganmian.net/blog/2008/11/21/chinese-python-translating-a-programming-language/

http://www.fiber-space.de/EasyExtend/doc/teuton/teuton.htm

The Teuton page links to a post on Artima by Andy Dent which discusses this
further.

Basically, the idea is that you start with the source code to Python,
written in C, change the keywords, and recompile. If nothing breaks, you
should then be able to program using non-English keywords.

As an alternative, you might consider using a pre-processor which translates
your dialect of Python+Igbo to standard Python before running the code.
Google for LikePython and LOLPython for some ideas.



-- 
Steven

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web