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().ПолныйПуть;
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:
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.
If one day, the code is released as open source, most developers in the world won't be able to work with it.
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
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?
Again related to accents, French keyboards are pretty bad when it comes to writing capital accented letters. You can write the letter
Ê, 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:
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.
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
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.