Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Writting Perl reserved words in Spanish or other foreign languages

by TGI (Parson)
on Oct 12, 2007 at 17:25 UTC ( #644514=note: print w/replies, xml ) Need Help??

in reply to Re: Writting Perl reserved words in Spanish or other foreign languages
in thread Writting Perl reserved words in Spanish or other foreign languages

If one had to produce the source filtering code from scratch, I might agree with you.

However, Filter::Simple offers the FILTER_ONLY interface, that makes it easy to specify code only transformation.

package Lingua::Perl::Espanol; use Filter::Simple FILTER_ONLY code_no_comments => sub { s/push/empuja/g; s/use/usa/g; #... }; 1;

All this is going to be used for is getting people used to basic concepts like flow control, stack operations, and so forth.

One could pretty easily make the source filter so that it can be applied in chunks and each chunk could be incrementally removed:

use Lingua::Perl::Espanol qw(no_list_ops no_flow);

The above could make list operations (push, pop, splice, etc) and flow control keywords return to their standard English form, while keeping file operations and other groups in Spanish.

If Filter::Simple works as advertised for simple code, then there is no technical reason not to use it. There may be pedagogical reasons not to use this approach. There are also similar reasons to use it. Which way will work better? I'd like to see some decent research that could answer that question.

Since the barriers to trying this with Filter::Simple are so low, I believe it is worth trying. If this is successful, many people around the world could find learing to program much easier with the help of Perl.

TGI says moo

Replies are listed 'Best First'.
Re^3: Writting Perl reserved words in Spanish or other foreign languages
by neptuneray (Sexton) on Jan 18, 2009 at 21:33 UTC

    I know I'm over a year late, but this application just came up in some consulting work. I believe it to be a GOOD idea to have a utility (or pre-processor) that accepts Perl keywords in Spanish. Anything that HELPS an inner-city Hispanic kid learn about computer programming is a Very Good Thing, indeed. The goal is to learn how to think algorithmically, not struggle with the English language (what's "croak" in Spanish? Please do not give me the word for "die" ...).

    I disagree with the argument that it is a "waste of time" for the kids, and an "equivalent to teaching Pascal", which they will never use in the "real world" (BTW, where IS that place?). I learned Pascal very early on, never used it professionally (PL/1 was the closest), but I am thankful of the Pascal experience (Damian Conway did an excellent webcast on this subject and Perl6). In fact, I wish that there never WAS a working Pascal compiler, but that the language concept was taught in school nevertheless.

    My German friends use English reserved words, but German variable names and comments. So why not have a translator that converts the entire Perl script (but I'd be happy with just the reserved words and Standard Library names)?

    Since I have never written a parser, and have limited experience in Spanish, I searched for such a thing, but only found sources for Perl language TRAINING in foreign languages. I'm new around here, so I might have overlooked something. Does anyone know of such a thing?

    Thanks, Ray

      The big problem with source filters is that they can break easily. As long as you are using for introductory purposes, though, I think such a filter would be fine.

      Your best bet if you want to try this is to code up an attempt at a Spanish filter. Install Filter::Simple, make a list of keywords, use a dictionary to come up with a start on the replacements, then talk to an interested native speaker to fine tune your list, then throw something together.

      Take a look at the source of Acme::Lingua::Pirate::Perl&emdash;Filter::Simple does the hard work for you, all you have to do is provide the transformations. The start I provided above should only need more transformations added to make it useful. Not that I consider what I did as significant, but please consider it public domain and use it as you will.

      If you are thinking about working with younger kids, you might want to look at using Scratch in Spanish.

      TGI says moo


        Thanks so much for your understanding of my problem and your help. I've taken a look at this, and I think that it is something I can handle with my knowledge of Perl. I just needed a place to get started without re-inventing the wheel.

        These kids are a bit older, so Scratch won't help.

        Funnily enough, I happen to be dating a woman fluent in Spanish, and she has agreed to help. She is not computer literate, which is ideal in this case.

        When I have something decent, I will report back.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://644514]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2018-05-24 04:31 GMT
Find Nodes?
    Voting Booth?