Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When you read C, C#, Java, Python, PHP and many other programming languages all the syntax is written in English.

Simple code like this

if (X+1 > 4) {
}
while (A == true) {
}

Is written in English even if the programmer's native language is something else.

Would it not be more effective to allow the programmer to use their own native language in the source code, like this (my bad Spanish so forgive me if it's wrong)

si (X+1 > 4) {
}
mientras (A == verdadero) {
}

There is no technical reason why a compiler or parser should be stuck with it's syntax hard coded. Any developer who has done internalization knows there are many easy ways to support other spoken languages.

You can run most IDE platforms in different languages. Yet, the programming language the developer is using is stuck in English.

Why have none of the major languages added support for language packs?

share|improve this question

closed as primarily opinion-based by gbjbaanb, gnat, Bart van Ingen Schenau, Simon, James McLeod Jan 4 at 16:04

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

10  
The Basic dialect in Excel 95 was localized. And that ... caused some problems. –  Joachim Sauer Jan 1 at 18:27
14  
...and who would review my Greek code? –  Yannis Rizos Jan 1 at 18:33
6  
English is the lingua franca of programming. The reasons don't matter. You can argue that it's arbitrary. But it's certainly not more arbitrary than any human languages in itself. As for Any developer who has done internalization knows there are many easy ways to support other spoken languages ... let's say that you're lucky to be a native English speaker - not because you didn't have to learn English later in life, but because you were spared the pain of being surrounded by poorly localized software. Using such software is certainly not more effective ;) –  back2dos Jan 1 at 19:22
5  
3  
@MathewFoscarini "Wouldn't this be easier from a mental problem solving perspective". No. Look at all the books, help etc about any programming language (the ones with English keywords anyway). I can only see this as counterproductive. English is my second language and I have zero interest in this. I remember a French version of BASIC back in the 80s. That seemed cool on paper, but then it was pretty obvious we weren't dealing with the same language anymore. –  MetalMikester Jan 2 at 0:08

4 Answers 4

up vote 6 down vote accepted

In layman's words:

They do.

In this wikipedia article you can see there are lots of programming languages/compilers/interpreters based in languages other than english.

Here is a sample source code in Linnotte, a French-based programming language:

 nombre Fibonacci : 
  a est un nombre
  début
   questionne a sur "Entrez un nombre :" 
   affiche fibo(a)

 fibo :    
  * n est un nombre     
  début
   si n est < 2, retourne n          
   retourne fibo(n-1) + fibo(n-2) 

.. and a hello world program in SAKO, a polish-based one:

K) PROGRAM DRUKUJE NAPIS HELLO WORLD
   LINIA
   TEKST:
   HELLO WORLD
   KONIEC

The question would be why most languages/compilers/interpreters uses english reservers words.

Compilers and languages are more useful the more people in the world have access to it and software projects are one of the disciplines that requires efforts from people in difference countries. For historical reasons english has become the predominant communication language in the modern world so is only logical most programming languages use english keywords. Should the course of history been different perhaps programming languages would be mostly latin-based, or french based.

English has some other advantages: it doesn't use accents and marks like áéíúóâêîôûäëïöü etc which makes it the lowest common denominator regarding keyboard layouts.

It's interesting to know that Niklaus Wirth who designed PASCAL among other languages was Swiss, yet he chooses english for the reserver words, as mentioned in this MSDN article.

Another curiosity:

While Perl's keywords and function names are generally in English, it allows modification of its parser to modify the input language, such as in Damian Conway's Lingua::Romana::Perligata module, which allows programs to be written in Latin or his Lingua::tlhInganHol::yIghun Perl language in Klingon. They do not just change the keywords but also the grammar to match the language.

share|improve this answer

Too much effort for too little added value.

The amount of English required to make sense of the keywords of any programming language is really very small - for the majority of second-language speakers it is probably way less than they already knew of the language even before they became programmers. Conversely, allowing all keywords to be replaced by their translations in other languages (and there are thousands of other languages!) would add to the complexity of the language implementation, would pollute the default namespace with thousands of tokens that are no longer legal identifiers, and would run the risk that whenever you have to review any code, you suddenly have to know what 'if' means in Czech to get it right. Almost all practitioners find these costs too high for the benefit of allowing people to program without rudimentary command of English.

Note that method and field names in standard or contributed libraries are another field. Most vendors stick to English for those as well, for largely the same reasons, but under particular circumstances the trade-off can be worthwhile, so there are some third-party languages with non-English public identifiers, but still a tiny minority.

Note also that this has nothing whatsoever to do with the question of whether English is particularly suited to express programming logic, or whether it is fair that U.S. and British programmers have a head start. The language has gained its present de-facto status as a computer standard largely through contingent historical processes (events that might have turned out otherwise, but in fact didn't). Although many people don't like this, few dislike it so much that they are willing to go back and deliberately re-introduce the possibility of fragmentation just to spite the Americans.

share|improve this answer
3  
Good point about illegal identifiers (which, of course, is only necessary if interoperability between dialects is necessary, and if user-identifiers follow the same syntax as keywords (e.g. older Perl versions sidestepped this completely with sigils. But we wouldn't want all languages to be like Perl *shudder*)) –  amon Jan 1 at 19:07
    
...like Perl... y nt? We could go the full Cobol instead.. "Add 5 to MyVar giving MyRes on size error display "Error" end-add". I thought the reason a language like C# was popular was because of its "terseness", after all C# and VB.NET are exactly the same thing except for the words used. –  gbjbaanb Jan 1 at 19:43
    
@amon one can program perl without sigils... and in non-english too. See Lingua::Romana::Perligata –  MichaelT Jan 1 at 20:38
    
@MichaelT Technically, Perligata is a different language that transpiles to Perl source code (compare the CoffeeScript and JavaScript relationship). There is also a Klingon version. In Perl4 user subroutines had to be prefixed with an ampersand: &while(1) which avoids any clash with builtin operators or keywords. This was relaxed in Perl5. –  amon Jan 1 at 21:08

The main reason is that all source code should be written in English. This applies as well to variable names, comments, etc.

The reason becomes obvious when you see for the first time a piece of code which is written in a language you don't know. For example:

// Записать изменения конфигурации.
var имя = this.RefreshMeta().ПолныйПуть;
this.Хостинг.Записать(имя);

Suddenly, you can't understand it, so you can't review, modify or unit test it. Additionally, in my example, you can't even work with it because you don't have Russian keyboard. In other words, you can't work with this code any longer.

This might be acceptable for closed source projects done by small companies. With the drawback of forbidding themselves to hire one day a skillful developer abroad who doesn't speak the language the code is written in.

Working in such company where French is preferred for code comments and documentation, I notice several issues with that:

  1. Like said above, hiring is de facto limited to people speaking French.

    If the language itself is localized, this means even more hassle compared to a case where only comments or variable names are.

  2. If one day, the code is released as open source, most developers in the world won't be able to work with it.

  3. While we work with .NET Framework and SQL Server which are fully Unicode-compatible, colleagues are often afraid of putting appropriate accents on letters, resulting in barely readable and extremely ugly names such as DELAI_EXPIRE.

    For people who don't speak French, DELAI_EXPIRE should be written DÉLAI_EXPIRÉ. Written in its first form, it makes it difficult to understand, and can have two meanings: either it means that a delay is currently expiring, or that the delay is already expired.

    If keywords of a language are localized, should accents be included? Should they be removed?

  4. Again related to accents, French keyboards are pretty bad when it comes to writing capital accented letters. You can write the letter À or Ê, but not É, such as in Également. This makes it pretty difficult to use auto-completion within an IDE.

    What would happen if one of the keywords of a language begins with a character which is difficult or impossible to type on a keyboard?

A note about IDEs

IDEs are localized because:

  1. They contain a lot of terms, sometimes complicated ones.

    By comparison, most languages contain only a few dozens of keywords, which are often words learnt in schools.

  2. They contain text which is intended to be read.

    By comparison, keywords are... keywords. For example, the keyword var in C# doesn't have any meaning in English. It's an abbreviation from variable, but still not an English word. Knowing that var is an abbreviation from variable won't help me understanding the concept of implicitly typed variables. It could have been implicit or imptype or unknown.

  3. The usage of a language in an IDE by a colleague doesn't affect other developers. One can have Eclipse in Italian, while his colleagues are happily working in Portuguese.

    By comparison, using a specific language in source code means everybody should understand it, because version control won't magically translate comments or keywords written in Russian by a Russian developer to Japanese for his colleagues in Japan.


So why English (5.52% of world's population being native speakers), and not, for example, Mandarin, (14.1% of world's population being native speakers), or Spanish (5.85% of world's population being native speakers)?

Because of historical reasons, English is used internationally and learnt in schools in most countries. It's even more predominant on the web, and even more among programmers. One can either stick with that, and use English for communication with pairs, or try to change the world so that Spanish, Romanian or Kurdish become the next language every programmer agrees to use.

share|improve this answer
    
Your argument supports using a single language for keywords and comments, not exclusively using English. In fact, it's a pretty good argument to utilize a translated language, since in some cases English obviously isn't used. –  DougM Jan 1 at 22:10
    
I'd remove implicit as an example replacement for var in C#, since implicit is also a C# keyword which means something completely different. –  Darrel Hoffman Jan 2 at 3:19

It's an error to state that "[in] programming languages all the syntax is written in English" or "Simple code (...) is written in English". Programming languages and natural languages are different things. Programming language tend to borrow some words from mostly English (the most prominent exception is probably null from German), in the same way English language borrows word "program" from French.

Other than a few words, virtually nothing from English is borrowed by programming language - syntax, tenses, conjugation, declension etc.

One may ask why English is the language tha programming languages borrow their vocabulary from. Answer is rather geopolitical than technical in nature.

Having said that, I know several people that do not speak English that are proficint coding in several programming languages.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.