Why don’t compilers support non-English keywords? [closed]

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?

18

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 use english reserved 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 require efforts from people in difference countries. For historical reasons english has become the predominant communication language in the modern world, so it 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 choose english for the reserved 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.

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.

4

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.

2

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.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật