You might think I’ve gone crazy. Posting about not coding in Spanish in Codespanish.com!
I actually promote the translation of your software to Spanish and other languages. When I say that you shouldn’t code in Spanish I mean don’t use Spanish or any other language than English in your variable names, file names, function names, etc. Programming languages, scripting languages, OS commands, etc., are all based on the English language. So, why would you do any different with your code?
Take for example this PHP code from the post “Building a forum in PHP and Mysql”.
$id = $_GET["id"];
$citar = $_GET["citar"];
$row = array(“id” => $id);
$sql = “SELECT titulo, mensaje, identificador AS id “;
$sql.= “FROM foro WHERE id=’$id'”;
$rs = mysql_query($sql, $con);
if(mysql_num_rows($rs)==1) $row = mysql_fetch_assoc($rs);
$row["titulo"] = “Re: “.$row["titulo"];
$row["mensaje"] = “[citar]“.$row["mensaje"].”[/citar]“;
$template = implode(“”, file(‘formulario.html’));
Some of the words might be familiar to English speakers as they have similar spelling in English, for example: configuracion is configuration, but what about mostrarTemplate? Even formulario (meaning form in Spanish) will give a headache to more than one programmer who doesn’t speak Spanish.
You have also to consider that many programmers are not even English speakers. They might speak languages that have no Latin roots at all, for them it is hard enough to interpret English functions like require, echo, etc. Can you imagine a Chinese developer trying to understand your code in Spanish? Writing your code in English is critical when you work on an open source project.
My view is that code should be written in English: variable names, function names, class names, data fields… When I mean code, I am also talking about databases. There are exceptions; objects named in English could be a problem if the final user has free access to generate reports, export data, etc.
It isn’t difficult to write your code in English. Use a Spanish/English (your_language/English) dictionary (I recommend www.wordreference.com). Don’t panic, it is not about writing like Shakespeare, grammar isn’t needed. For example, in the above code, mostrarTemplate could be easily changed to showTemplate.
Even if you are not intending to outsource, share or sell your code, having functions in Spanish mixed with native functions of a particular programming language is a bad practice that could lead to confusion and duplication of code. For example, somebody could write a function obtenerVariable (obtener means get) when there is already a function called getVariable included in the library of your programming language. If you had written your code in English and duplicated the function getVariable by mistake, it is very likely that the compiler or the code interpreter would warn you. This is unlikely to happen if you mix human languages in your code.
What about comments within the code? Although it might be challenging for most non English speakers, the reality is that most comments are normally made of one or two sentences. As I said before, it is not about writing perfect English. There are several tools that can help you to translate simple sentences. Freetranslation.com is my favourite one. Be aware that these tools are not 100% accurate, human translations haven’t been beaten yet. If you need to translate a manual, the content of your website or the messages shown to the user by your software, please hire a professional translator.
Don’t get me wrong, I am strong advocate of my mother tongue, Spanish, but I’m not a fool. In today’s world a foreign company could approach you to buy your product rights at any moment. For example, last year Google bought Panoramio, a company founded by Spanish born Eduardo Manchón. If your code is unintelligible for non Spanish speakers, it will be harder to outsource its maintenance (you are limited to Spanish programmers). This last point could be a discussion topic with international investors.
Like it or not, English is the technology and business Esperanto of modern times. You should be writing your code in English.
Stumble it! Bookmark it! Digg it! Menéame! Fresqui Suscribe Suscribe