Babylscript - a multilingual language
Written by Alex Armstrong   
Monday, 23 May 2011

Until now English has been the language of programming and non-English speaking programmers have had to put up with a situation that is far from ideal.  The Babylscript project now offers an alternative for JavaScript programmers.

What language would you like to program in?

No this isn't a Ruby v Perl v Java v ... argument.

Let's rephrase the question as "What natural language would you like to code in?".

If you have never thought about this problem then it is easy to predict that you are an English speaker. As computing mostly started out in the US and UK (with apologies to every other non-English speaking inventor of the computer, e.g. Konrad Zuse, Sergei Lebedev and so on) the dominant language used in computer programming has been English. Speakers of other languages just have to adapt to using words like "if" and "for".

There an argument that some programs at least would be better coded in the language of the country that the application is intended to be used in - not just literal strings but keywords as well. There is an even more persuasive argument that teaching a language is easier in the students own natural language.

 

babylscript

 

Now you can use multilingual programming in JavaScript. The Babylscript project has taken the Rhino engine and added the ability to code in almost any language you care to add a translation mapping for. At the moment the language support is restricted to English, French and Romanian - but adding new languages is simply a matter of defining a keyword mapping. The project is looking for help creating new mappings.

You can even swap languages in mid program by including a language indicator:

---fr---
fonction fn()
{
   alerter(«bonjour!»);
}

As well as simply allowing keywords to be translated there is also a facility that allows objects to define alternative names for methods and properties. For example:

// This object has a method with a 
// default name of go() var obj = new Object(); obj.go = function() {...}; // In French, you can use aller()
// to call the go() method obj['fr':'aller'] = 'go';
---fr---
// In the French language mode,
// aller() will be mapped to // the go() method obj.aller(); // In the French language mode,
// you can also use the default // name go() to call the method // obj.go();

This allows mappings to be created for libraries and APIs that makes them multilingual as well.

Programming languages in an ever growing world cannot hope to simply work in English but little thought has been given to creating multilingual standards for languages. You might well conclude that English is a perfectly good abstract language and quite sufficient.

However consider how you might feel if the next big language was invented in China with no English translation. That is one way for the emerging world to lock us out of their expansion plans.

Perhaps we do need to look at ways of accommodating more than just English within programming languages.

More Information

Find out more about Babylscript and perhaps create a translation mapping for your own language at:

http://www.babylscript.com

 

Banner


Azure AI And Pgvector Run Generative AI Directly On Postgres
26/03/2024

It's a match made in heaven. The Azure AI extension enables the database to call into various Azure AI services like Azure OpenAI. Combined with pgvector you can go far beyond full text search. Let's  [ ... ]



Is PHP in Trouble?
10/04/2024

The April 2024 headline for the TIOBE Index, which ranks programming languages in terms of their popularity, reads, "Is PHP losing its mojo" asking this question because this month PHP has dropped out [ ... ]


More News

Last Updated ( Sunday, 25 December 2011 )