93
votes

I've heard it said (by coworkers) that everyone "codes in English" regardless of where they're from. I find that difficult to believe, however I wouldn't be surprised if, for most programming languages, the supported character set is relatively narrow.

Have you ever worked in a country where English is not the primary language?

If so, what did their code look like?

9
  • 14
    It makes sense to name all things code in English to make it more integrated with frameworks not even mentioning the non-latin writing languages (I should find some Cyrillic or Chineese code; that would be interesting). The question is of course: Should it be British or American English? There are parts in .net framework with British spelling while most of it is in American. Sep 15, 2010 at 19:07
  • 3
    Really? Where is the British spelling? The American English used to annoy me (I'm Australian), but I'm used to it now...
    – Damovisa
    Sep 16, 2010 at 2:39
  • 55
    The problem with questions like these is that people writing English answers to your English question on this English Q&A site are probably not representative of all programmers in non-English-speaking countries.
    – Larry Wang
    Sep 20, 2010 at 5:36
  • 3
    a code sample wonderfl.net/c/iUH0/read
    – www0z0k
    Feb 5, 2011 at 14:33
  • 1
    @Larry Wang: True, Stackoverflow users probably aren't representative. But we work at normal companies with normal coworkers and normal (read: representative) coding rules. So I think the answer's to this question aren't that distorted.
    – nikie
    Feb 5, 2011 at 23:33

108 Answers 108

1
vote

I work for a software editor in France. Code is always in English. The variables and function names are all in English even if mistakes occur sometimes. The worst mix of French and English I encountered was "connexionKey". On the other hand, comments are not always in English depending on how confortable the developer is writing English.

3
  • 1
    While I don't know the situation you encountered, "connexion" is the original English spelling and (at least according to Wikipedia) still somewhat used.
    – Roger Pate
    Sep 9, 2010 at 10:52
  • Connexion isn't so bad. I once got into a discussion with a British colleague about the word manouever because I thought it was a misspelling. Old/adapted/culture specific words are even an issue among primarily English speaking cultures. Sep 11, 2010 at 9:35
  • 1
    I think "manouever" is a misspelling. The British spelling would be "manoeuvre." (And yes, I had to look that up to be sure; I'm very good at spelling most words, but anything derived from "oeuvre" throws me for a loop.) Sep 20, 2010 at 23:11
1
vote

From Brazil,

I write generic code in English but I prefer to use Portuguese when programming near to domain application. Some terms don't fit well in application when using alien words to domain. At same time, there is a clear separation between generic coding and domain coding.

1
vote

If you talking about using a native language on programming language own statements and API, well, in this case I can say I see in the past a very popular product in Brazil derived from xBase but whole in Portuguese.

If -> Se While -> Enquanto Left -> Esquerda Create -> Criar etc

But I think this kind of languages doesn't get too much successful.

1
vote

I'm from Serbia.

When I code for school, I almost always use Serbian comments and variable names. That code will never be read by someone who doesn't know Serbian anyway and will never be used outside of the exam it is written on and I don't see the point of using English for English's sake.

When I'm doing some coding for myself, I tend to use Serbian too, because nobody else is going to read it and I need code to be readable easily for me and not some non-existent third party. The bad side of this is that I'd have to translate source code of a program if I'm going to share it internationally, but this never happened to me so far.

When I'm writing code which other people will read, I use English and English comments. I generally do my best to make English as readable as possible and to have as little spelling errors as possible. New IDEs with English dictionaries help here.

My reason for preferring Serbian is simple: I'm sick of code which is supposed to be written in English, but looks more like Engrish (or Senglish in my case). Furthermore this so called English continues to evolve separately from English used in countries which actually speak English. This way words which are seriously outdated in modern English, or never existed in English at all keep popping up in source code and in programmer's speech and slowly find their way into technical literature. This way instead of making new words for English technical terms in Serbian, we are making new words for English technical terms in English which English users will not recognize.

1
vote

I work in Japan.

I'd say 40-60% of code I see uses English variable/method/class names. Sometimes Japanese and English is intermixed. Comments and commit messages are almost always in Japanese.

Consequently you see a lot of code written in poor English, and it's quite bad because it hurts readability a lot. Unfortunately, code done in Japanese isn't much better, either since Japanese written in Alphabet (in particular, lack of Kanji) is tough to read.

Sometimes engineers do use 2 byte character (Kanji/Hiragana etc.) method/variable/class names (it's legal in e.g. Java) but this frequently causes great pain because of character encodings (build blows up etc.) and is usually frowned upon.

There is a lot more emphasis on English for Japanese Engineers in the Japanese job market, so I'm hoping that this situation improves soon (I code entirely in English and I believe all Japanese engineers should, too)..

1
vote

I'm from China, and I code in English like how others did. Except I use "words for children" in some API methods, I lack vocabulary.

Imagine a API with identifiers written in German (or even Japanese) is being used in English code...

1
vote

In Quebec, teachers are apparently obligated to show their class material in French, which tends to result in awkward Frenglish code. Many students apparently follow the lead, but I'd say most are incomfortable with such bilingual code, and in most projects people will try to stick with English only, to the best of their English knowledge.

1
vote

I'm from Germany and I personally strictly code in english. The company I'm working at is doing projects for international customers and usually the code + comments are in english. The department I'm in though is doing a project for a german company only and most code in the core is full of german. I tend to produce new code in english and fill in english comments wherever possible.

1
vote

I'm from Valencia, Spain and the proper answer is "depends".

For most non-public/non-OS things i do a mix of English and Spanish in variable naming, but all my comments are in Spanish and I hope noone tells me to document/comment things in Valencian

But things change when you're publishing something under Open Source, since doing it in your local language restricts your potential users and collaborators to a smaller audience.

I can give you an example of language as a barrier: When I was running a WoW guild i began to look for alternatives to EQDKP and i found them, but most had it's documentation and comments in german so i lost any interest because relying on Google Translator wasn't an option for me, heck, some of them were awesome projects.

You also asked for a code example, as i told i tend to mix English and Spanish, but this snippet is so brief that i did not need any kind of mixture

function validaDNINIE(numero) {
// Eliminar todo lo que no sea número o letra
numero.replace(/[^0-9A-Z]/i, '').toUpperCase();
if (!numero.match(/((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)/i)) {
    return false;
}
// Comprobación de NIF
if (numero.match(/^[0-9]{8}[TRWAGMYFPDXBNJZSQVHLCKE]{1}$/i)) {
    var letra = numero.charAt(numero.length-1);
    if (letra == "TRWAGMYFPDXBNJZSQVHLCKE".charAt(numero.substr(0, numero.length-1) % 23)) {
        return true;
    }
}
// Comprobación de NIE
// T00000000
if (numero.match(/^[T]/)) {
    if (numero == numero.match(/^[T]{1}[A-Z0-9]{8}$/)) return true;
}
// ZXY
if (numero.match(/^[XYZ]{1}/)) {
    // X = 88, asi conseguimos X=0;Y=1;Z=2
    var su = numero.charCodeAt(0)-88 + '' + numero.substr(1, numero.length-2);
    if (numero.charAt(numero.length-1) == "TRWAGMYFPDXBNJZSQVHLCKE".charAt(su % 23)) {
        return true;
    }
}
// Si hemos llegado aqui es que el numero no es valido
return false;
}
1
vote

I do know that (at least back in Excel 5.0) the entire object model of Excel is/was localised in VBA macros for languages such as Spanish. So you dealt with CuadroTextos instead of TextBoxes for example. Visual Basic is still English though, so VBA programming is done in a kind of pidgin English.

2
  • 3
    This was the most idiotic thing Microsoft ever did. We got into huge problems on a project once because we tried to merge code written in Access. Some had English localized versions and some had Norwegian localized versions. Sep 20, 2010 at 8:16
  • Absolutely agree. You were unable to use code samples or documentation written by non-Spaniards. Sep 20, 2010 at 10:47
1
vote

I'm doing software development for more than 20 years now and with many different languages. But all those languages have one thing in common: the keywords, function names, etc. are in English. So I choose English as my language for all my identifiers etc. too. So it's simply more fluently to read.

In the beginning I commented in my native language, German. But one the net and OSS became more and more interesting I even switched commenting to English. So a larger community has the chance to read, understand, use, and improve my code.

mue

1
vote

I am from Israel. I work as a consultant for companies so it's fair to say I have seen hundreds of coding methods, coding systems with different technologies and languages.

every single one of them, even if it was a hebrew client side, the back-end was written in english, the variable names were english the method names were english like

checkIfCustomFieldsHaveAttachments(customField:CustomField):void

and so on and so forth.

personally, I am using english to code all of the time, I never use anything else.

1
vote

Bolivian coder here - 100% of our code is in English, comments and variables. Why decided upon this because

A) By not using English you are essentially cutting off help from a very large pool of professionals

B) The vast majority of programmers know English to some extent.

1
vote

I'm Norwegian, and while I've met many people coding in (and seen lots of code in) Norwegian, I only code in English. This question was brought up on StackOverflow once, and the reason I gave for only using English es consistency (getAlder() seems weird) and the question of what to do with our three special characters æ, ø and å (getKjøretøy() might not work in all languages). According to friends of mine, at least one large public project is coded in a combination where the technical terms are in Norwegian.

I don't speak a word of French, but when I was learning PHP and Mysql I read a tutorial (in English) which was obviously written by a French programmer, because all the variable names were in French. When I copied the example into my project, I couldn't be bothered to change the variable names, and I stuck to those names for a very long time, so most of my Php code was littered with French variable names.

1
vote

I'm russian, here we code in MSVC++, this is what the code looks like:

    #include "stdafx.h"
#include <iostream>

использовати площадь какобычно аминь1

наместе двояко провѣрятичегоглаголют молчаливо
кагбе
    ѣжѣли получалка.сломалася молчаливо тогдауж 
    кагбе 
      молвити "Не лепо молвишь, барин!" аминь1
      возвѣрнути нуль спасихоспади1
    ага
    возвѣрнути один аминь1
ага

цѣло голова(цѣло количество_указов, глаголют указы[])
кагбе 
  дваждыточно первыйсундук, второйсундук, отвѣт аминь1
  буквица знако спасихоспади1
  творити 
  кагбе
    молвити "молви первый цифирь, барин: " аминь1
    получити первыйсундук аминь1

    ѣжѣли провѣрятичегоглаголют молчаливо еси ложъ тогдауж прѣрвати спасихоспади1

    молвити "молви деяние, барин: " аминь1
    получити знако спасихоспади1

    ѣжѣли провѣрятичегоглаголют молчаливо еси ложъ тогдауж прѣрвати спасихоспади1

    ѣжѣли знако еси 'q' тогдауж прѣрвати аминь1

    молвити "молви второй цифирь, барин: " аминь1
    получити второйсундук аминь1

    ѣжѣли провѣрятичегоглаголют молчаливо еси ложъ тогдауж прѣрвати спасихоспади1

    избирати знако 
    тогдауж  кагбе
      выборъ '+' сталобыти
        отвѣт буде первыйсундук да второйсундук аминь1
        прѣрвати спасихоспади1
      выборъ '-' сталобыти
        отвѣт буде первыйсундук бѣзо второйсундук аминь1
        прѣрвати спасихоспади1
      выборъ '*' сталобыти
        отвѣт буде первыйсундук повторити_столько_сколько второйсундук аминь1
        прѣрвати спасихоспади1
      выборъ '/' сталобыти
        отвѣт буде первыйсундук убрати_столько_сколько второйсундук аминь1
        прѣрвати спасихоспади1
    ага

    молвити "Отвѣт есьм: " аминь1
    молвити отвѣт да_промолчати спасихоспади1

  ага
  пока (истино) аминь1

  возвѣрнути нуль спасихоспади1
ага
1
  • You're kidding, right? This looks like Old Church Slavonic, or at least a very old version of Russian. Jan 18, 2011 at 18:49
1
vote

I'm from Brazil and in all the jobs that I had most of the code was written in Portuguese. Variables, classes, methods etc. Most of the programmers and other people don't speak english.

Here is some code:

function buscaFotosMateria($idMateria) {

        global $conexao;

        $consultas['Materia']['pegaFoto'] = "SELECT * FROM sgc_materias_fotos";

        $params = array();
        if($idMateria) {
            $consultas['Materia']['pegaFoto'] .= " WHERE mfot_mate_iden = ?";
             $params[] = $idMateria;
        }

        $conexao->executaConsulta($consultas['Materia']['pegaFoto'], $params);

        return  $conexao->resulConsulta; // VARIÁVEL DE INSTÂNCIA DA CLASSE QUE ARMAZENA RESULTSET DA CONSULTA REALIZADA
    }
1
vote

I'm french and working in Germany, in research (physics). My codes are using mainly english words, but also french ones here and there, and even sometimes from other languages, especially when the word is shorter there for instance. As for comments, I usually write them in french if they are supposed to be temporary, during the coding, and in english if they are supposed to stay permanently and help a possible reader. But sometimes temporary comments stay longer than expected, so there is language mixing there as well.. Anyway, probably I would uniformize all this if my codes were shared with other users/programmers. It really depends on the environment: in my research work & team, people exchange more their ideas, results, .. than their codes themselves - codes are sometimes specific to a project, sometimes not to the project to the programmer - this works up to a certain level of coding complexity, I heard of some codes (or "families of codes") shared by dozens of labs and evolving since years, these are surely only in english.

1
vote

I worked in a Japanese software company for a while. The code, including variable and function names, was all in English. Comments and inline strings were in Japanese. Occasionally the function names were poorly translated, which made programming ... interesting... at times.

1
vote

I'm from Mexico, and I personally never use Spanish for anything, even my own hobby projects (because I figure maybe someday I'd like to share the code or ask buddies to help out). I generally oppose to anything but English when it comes to tech stuff. One major pet peeve of mine is when companies use Spanish (in my case) as the default lang in their software... Apache (Tomcat) does this, so does Google. E.g., if (in the case of Tomcat) you're looking for more info on an Exception in Spanish, you're likely gonna get less results compared to the English description of the Exception. Same with Google, results in Spanish pretty much suck if you're looking for almost anything (lousy websites, outdate info...) Facebook and many open source apps do some horrible translations, too. Also translations might not fit everyone's needs. In Spain a 'file' is normally a "fichero" while in Mexico it's an "archivo"... Other Latin American countries have their own variations too.

It may sound a bit harsh for some people, but in my opinion coding in English is a "best practice". It's not a matter of xenophobia or racism or nationalism; it's a matter of scope and standards. English is generally accepted as an international business language, and it works. This has of course its own disadvantages (like bad English comments or specs gulp!), but I think that it's got more advantages.

One gem that I can remember was an error message that said:

"An error has happened!" (Mex code)

Indian code is also good stuff for a healthy laugh... Nobody's perfect, but the important thing is that we can understand each other (internationally speaking) instead of bringing more mess to our code.

1
vote

My primary language is English, but I frequently misspell in British English. Does that count? :D

1
vote

When I was at university in Switzerland I worked on a Modula-2 project, where everything (variables, comments, messages, etc) was in French, except for the keywords of the programming language. They also told me there were preprocessors available that would allow you to write the keywords in French as well, so "si" = "if", "alors" = "then", "sinon" = "else", etc.

1
vote

I'm Hungarian, working in my home country with a team consisting mostly of fellow Hungarians. We always write our code and comments in English, since that is the official language of the company anyways. In addition to that, some of our projects are open source, which really mandates that everything is in English.
This has a funny side effect, by the way: sometimes my mind stays in "English mode" after work and I keep thinking in English on the way home.

1
vote

I am Indonesian currently living in Kuwait.

In the first year of my computer science studies, I used Bahasa for almost everything except int main(). But I noticed that some of us code in english already.

All of our programming books are in english. I find it very difficult to find words in Bahasa that are equivalent for programming terms. So instead of using half-english-half-bahasa language, I (and most of my friends) started to make every possible effort to code in english.

In my first working experience in Jakarta, Indonesia, I was obliged to code in english.

1
vote

I am from Denmark, and even though many of the technical terms translates nicely to danish, it is the norm to use the english terms (though some tend to ONLY use the danish terms, but I guess you see them everywhere).

Personally, I code in English; Meaning that all my comments, my variables, classes and so on, are in English. I do this because it makes it so much easier. If I want to make my code public, everybody can read and understand the program. If I am going to help out a friend with a code-example, I don't have to translate the comments beforehand.

1
vote

In PHP the :: operator is called Paamayim Nekudotayim which is hebrew for double colon. The rest of the langauge is in English. The first time I saw that error message about half of my office kind of confused us. And that was at a company in Israel

1
vote

In the Visual Studio editor, most of the places we deal with non-English bugs are in comments, and they are most east-Asian languages (Input Method Editor (IME) related). I'm pretty sure I just saw one the other day where right-to-left text in comments displays incorrectly in quick info or parameter help, so there are certainly people doing it :)

1
vote

I (dutchy) always code in English, it just makes much more sense, all the language keywords, etc. are in English, so why not code the rest in English? :)

I always put all comments in English as well. You never know who will have to edit your code, they might not speak your native language.

1
vote

I'm from the rotten state of Denmark. We primarily write code in English. Even the development guideline states that it should be as well. Being the newest developer in the company I assume that it was decided due to the framework we are using was done in English. It would be a horrible mess to read mixed Danish and English :)

With that said, we do write comments in Danish :)

0
votes

I worked with a 20-person team in Lima, Peru for several years on a classic ASP project. This was 10 years ago, so conventions may have changed, but at that time, all of the comments and variable names were in Spanish.

0
votes

I'm from the Philippines. Most people code, document, and name variables in English here. Also, I find English to be one of the most suitable language to use in programming because it has richer vocabulary than most languages out there.

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