in reply to International Perl Resources

I am curious about how often are computer languages themselves translated. Historically, it would seem that non-English speakers have had a substantial disadvantage when it came to programming because not only is the documentation in terse, highly technical English filled with obscure jargon, but the languages themselves are often composed of English words with a loosely coupled meaning.

Unlike mathematics or engineering, where equations look pretty much the same in any language (i.e. "E=mc2" or what have you) because of the use of Latin and Greek symbols, computer programming has taken a decidedly English bent ever since the first real "langauges" evolved out of the primordial machine language, and this includes assembly language.

If you had no idea what English was, and perhaps had only recently learned the Roman alphabet, Perl code, which can often look like line noise even to the average educated English-speaking programmer, may look even more inscrutable. Can you tell what this really basic Perl program does?
#!/wba/xqf/rtla dom cdzwcw; dom MZW jp (:biafcluv); ib ($i) = unx MZW; pldml $i->pzvbno(); pldml <<NFC; <DUUT> <GHHE> <QPDKS>Gl Jbipl Ricf</QPDKS> </GHHE> <CFQD DSFXHYU=Fgzqu> <K>Gchne, dcgdz!</K> </CFQD> </DUUT> NFC
Which would be even further complicated if the programmer wasn't even used to reading "right-to-left", such as Hebrew, or Arabic.

In a discussion with some associates, we were debating the merits of translating the syntax of a given language, such as HTML or Perl, into a coherent and understandable version for another language. I was thinking that even if this alternate version required a filter or parser to work properly, it would certainly chop a few major steps out of the learning curve, such as "Step 1: Learn English (One of the Most Unwieldly Languages on Earth)".

Translating the core syntax shouldn't be a terribly difficult job, at least technically speaking. This could be done any number of ways, from a module which would work on any program by Filtering the input, to a re-compiled interpreter which was called if the program was in a certain format. Converting between syntax-sets could be done easily, as the symbols may be represented by different characters. "A `shift' by any other name..." as Shakespeare might have said, were he a Perl programmer instead of a playwright.

Progressive projects like the Multilingual Domain Names are making the Internet a whole lot more understandable and accessible to the world at large. Certainly the programming languages that have made the Internet what it is today will make a similar effort.

Too wacky, or is this sort of thing worth considering?

Replies are listed 'Best First'.
Re: Re: International Perl Resources
by mirod (Canon) on Jan 30, 2001 at 21:05 UTC

    Translating a computer language is a _very_ bad idea.

    It has been done before, especially here in France. For a while I think the Ministery of Education was pushing a french translation of Pascal. Now that's something really (twice) useless! Seriously that's totally pointless. First "simplistic" English reads much better than simplistic French, and then when people have to maintain real-life code, written in a real, English-based language, then they are at a real disadvantage.

    The English used in computer languages is simple enough that a couple of weeks of training is enough to feel at ease with it. And even the English used in Computer books, once you understand how compound words are built is usually pretty simple. I remember reading technical manuals _way_ before I was able to read even the simplest novel in English.

    IMHO you should not waste your time, and above all the time of people who would use "translated" languages.

      That'd be an interesting thing to see :
      utilisez le français ou mourez;

        Easy, you can write this (from the Camel 3 p. 280):

        #!/bin/perl -P #include "./francais.h" utilise strict; utilise Data::Dumper; mon %hdh; # mes, ma and mon are all like my tant_que (<>) { suivant sauf_si( r/^(.*?):\e*//); # r -> remplacer \e -> espace mon FFqui=FF1; # I do not have the Euro sign on m +y # keyboard so I used F(rench) F(ra +nc) pour mon FFchamp( separe) { mes( FFclef, FFvaleur)= separe /=/, FFchamp; FFhdh{FFqui}{FFclef}= FFvaleur; } } imprime Dumper( %hdh);

        Of course you need a francais.h file

        #define utilise use #define mon my #define ma my #define mes my #define tant_que while #define sauf_si unless #define separe split #define suivant next #define imprime print #define ouvre open #define meurt die #define pour for #define ou or #define execute() \ while( <DATA>) \ { $programme .= $_; } \ $programme=~ s{FF}{\$}g; \ $programme=~ s{r/}{s/}g; \ $programme=~ s{\\e}{\\s}g; \ eval( $programme) or die $@; execute(); __DATA__

        And then you can run it using an input file such as:

        pierreafeux: mari=frederic ami=barnabe femme=wilma animal_de_companie= +dino simpson: mari=omer femme=marjorie enfant=barthelemie dupont: mari=jean femme=marie enfant=pierre animal_de_companie=me +dor

        You will need to make this file executable, or run it with perl -P as you can't do just perl <file> and have the -P on the command line take-over properly.

        And I know it is not robust, especially the quick hacks to French-ize the regexp, ask Damian if you want a real French module!

        Update: I removed the display of the program and moved the execute(); call to the included file, it looks better now.

Re: Re: International Perl Resources
by Lexicon (Chaplain) on Jan 31, 2001 at 05:35 UTC
    I have to agree with Mirod on this one to some extent: translating the language itself isn't that important and probably would be for the worse.

    1) The English is easy, and utilizes basic gramatical constructs found in most (probably all) languages. This at least applies to your basic things like Use, If, While, etc... There's only a couple dozen key words in most languages that can be picked up quickly, and (speculation) probably the majority who has access to computers have had at least some exposure to English (/speculation).

    2) More complex commands often don't even make sense in English. My strongest example is map. Hell, that one's so confusing at first you may be at an advantage by not having predefined concepts of what it should do! ;)

    3) Imagine if you couldn't read/maintain code except from your own country. (I believe this is really the big important one.)

    4) The character set might be an issue, but:

  • The cyrillic character set is closely related
  • I believe all asian countries use the Latin character set to type anyway because they have too many letters (even just the phonetic ones (I base this on my Japanese experience, YMMV)).
  • India's second language is English.
  • This covers damn near everybody. ;)

    As for documentation, the Japanese take a mandatory 4 years or so of English, and the average person has little hope of tackling a technical manual. Moreover, programmers are generally bad with langauges, and I wouldn't want to force quite that much English on anyone.


      While using a "translated" language is perhaps a bad idea, the idea of using a "filter" such as mirod's "french.h" file is more in line with what I was thinking. Perl makes it so easy to implement such a system, and still maintain full compatibility with other code.

      When it comes to maintenance, I have found that some German and French code is hard to "decode". While all the regular keywords are there in plain English, everything else, variables, functions, and comments, are not. Babelfish comes in pretty handy when trying to discover the meaning of some of the comments. I also notice quite a bit of Japanese SJIS-enhanced code that I can't even edit properly without a UNICODE-compliant editor (i.e. not 'vim'). So much for "portable" code!

      A "translated" Perl would be used as a crutch of sorts, to ease the learning programmer into the language.

      In any event, Perl should at least allow you to use Japanese and French style quotes so that you don't have to escape your code!
      print «I am tired of 'escaping' my "quotes"!»;

      Curiously, do the "4 years" of English that the average Japanese take leave them with an understanding that is any more useful than, say, the 4+ years of Spanish or French that an average student from Britain, America or Canada would have? Probably, as many have pointed out, this brief introduction would be enough to get a handle on the syntax with proper supporting documentation available in the primary language of the learner.
        OK, there is this var/sub naming problem. To be extra confusing, the Japanese seem to like to mix it half-English/half-Japanese in the code I've seen. I also havn't seen them writing it in actual Japanese, just romaji, but that's just due to where I work (mostly web stuff).

        OT: IANJ but I think students take 6 years of English. College entrance exams have English components. The average American takes 2 years of a language (that's what I took anyway) and they're about equivalent to the Japanese English in skill. I don't find that relavent though, as going from English to Spanish is a hell of a lot easier than from English to Japanese or back. So I forgive them some. (^v^)

        OK, enough rant. This is certainly enough that they can read all basic syntax without any issues. But one of my tasks is to help with the translation of English technical references into Japanese. That was more about Japan than anyone ever expected to learn on PerlMonks. If anyone has any questions though, feel free to CB me.


Re: Re: International Perl Resources
by $code or die (Deacon) on Jan 31, 2001 at 02:30 UTC