RE: international language support
- Posted by freeplay at mailandnews.com Aug 15, 2001
- 1101 views
>===== Original Message From Kat <gertie at PELL.NET> ===== >> I think that one thing that would help to popularize >> euphoria would be international language support. >> When I talk to people here about Euphoria - which >> is pretty often - they are interested, but are put off >> by the english. So would I be if I had to program in >> german, say, or chinese or something. So I thought >> that it might be a 'simple thing' to write a preprocessor >> that would substitute the keywords, builtin commands, >> and common library routines from one language to >> another. A simple list something like: >> >> {{"end","fim"}, >> {"include","incluir"}, >> {"to","ate"}, >> {"by","por"}, >> {"exit","sair"}, >> {"type","tipo"}, >> {"constant","constante"}, >> {"for","para"}, >> {"while","enquanto"}} etc. >> >> This would allow a portuguese programmer to write >> code in his native language. The preprocessor would >> look for these words and substitute them for the english >> equivalent then run the program. >> The list could be an include file, that could be replaced >> by any other language that you would care to. French >> Russian, Arabic, Swahili, Malay. etc. >> OK. The problem is the word 'simple'. Simple for some >> but I'm not up to it. Does anybody else think this is a >> good idea and does anybody want to tackle It? I've got >> the translation/substitution list for Portuguese (one of the >> top ten spoken languages in the world) if anybody would >> like to try. >> Or maybe its already been done and I just didn't find it, >> in which case, inform me please. > >I had suggested this be done natively, if the include lang.ini was in the bin >dir, Eu could read the program code in whatever language was in that ini file. >Send me a list of the keywords you want translated. > >Kat This sounds a nice feature but would it not complicate the process of exchanging code with programmers who have a different "lang.ini" file than you? Here is a simple bit of code I've written: function main() integer fim fim = 0 while fim < 10 do fim = fim + 1 printf(1, "Loop is %d\n", {fim}) end while return(0) end function abort(main()) I have a integer variable call "fim". Now if I give this code to a Portuguese Euphoria programmer who has a "lang.ini" file that maps "fim" to "end" I can see a clash occurring with the Euphoria reserved word "end". Or am I missing something? I think that allowing a programmer to specify their own reserved keywords would be a great feature but _really_ difficult to implement. The number of reserved words suddenly becomes potentially huge so the possibility of a name clash with a reserved word and an identifier increases. My understanding is that the whole point of having reserved words in a language specification (function, procedure, end, if, else, elsif, while, for, by, type...) is that it makes the code easier to parse. The downside is that those reserved words cannot be used as identifiers by the programmer. That's the reason I like languages which have a minimal set of reserved words. Regards, FP.