Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A few weeks ago, my class was assigned to translate to Portuguese the book Real World Haskell. As I did the translation of the text and comments, I started to wonder if I should translate the code as well, as the instructor suggested. For example:

data BookInfo = Book Int String [String]
              deriving Show

would become

data InfoLivro = Livro Int String [String]
               deriving Show

Since I haven't read any software-related books in Portuguese, I don't know if that's a common practice, neither if it should be done this way. In the end, the code is a language mix (perhaps the example in Haskell is not a good one, since you can create synonyms quickly like type CadeiaDeCaracteres = String, but you get the point). So it doesn't really matter how hard you try, you'll have to rely on the reader previous experience with some sort of basic English words.

Knowing this, I really don't see the point in translating code, since we learn in the early days of our coding life it should be written in the universal language. Nevertheless, if the surrounding text (comments, for example, and text itself in a book) needs to be translated, what is possible and feasible in this matter? Can you provide me with some guidance of what to do?

share|improve this question
What does the instructor expect you to learn from this? Yes, you might learn a little about Haskell, but it sounds like it's mostly a test of your English translation skills. Does he just want a translation for future classes, and he thinks wasting the time of all the students in this class is the way to accomplish it? My bet: all you'll learn is why translation is a specialized field best done by experts. – Dori Oct 21 '10 at 4:02
Related question:… – David_001 Oct 21 '10 at 6:37
@Dori I completely agree. Sadly, that's how my university works, at least in CS field. – Raphael Montanaro Oct 21 '10 at 15:12
you should tell him something like this: """Professor, você está realmente louco. Eu preferiria dormir com sua mãe do que fazer isso. Aprenda Inglês ou perecer.""" – Job Jan 23 '11 at 18:41

In my opinion, no. Most programmers are forced whether they want it or not, to learn english, and nowadays it is the lingua franca of the software world.

In my experience, however, books written by authors in one of the stronger languages, have a tendency to do that - so far I've seen the practice in books in german, french and russian (well, russian is a little different of a case, since they use different alphabet as well). It is a rule of thumb that it depends on the country's dependency on english.

The text is of course translated, the bigger comments also (one that describe the workings of a program in greater detail), then somewhat more rare, smaller comments and variable names. I've also seen the case where variable names were translated, but smaller comments were left in english. I believe the author however, in that particular case, was counting on his audience to have a working english knowledge.

Sorry if this didn't solve your dilemma, but there still isn't a consensus on this one :-/

share|improve this answer

I'm brazilian [we speak portuguese here, ofc] and, when I can choose between the original or the translated version, I always take the original, since almost every book is translated to people who aren't programmers so commands and expressions lose their original meaning after the translation.

Another reason to want books in english is that everything on web [or the best things, like this site] is written in english, so you will be familiarized with the english term and you will be able to understand better other people code... [since a good programmer would code in english, at least from my POV]

If you need to read books in portuguese [or another language] prefer those written on that language [not translated].

To make it clear: if you are going to translate that book, try to keep all code in english [comments may be translated, but not vars or funcs] and don't try to translate stuff like 'array' to 'arranjo' or 'mouse' to 'rato' [at least I would prefer the english term, people on Portugal would prefer the second, I guess].

share|improve this answer
+1 for needing an expert in all three of (source language, target language, programming) – Frank Shearar Oct 21 '10 at 5:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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