I'm a native Portuguese speaker. Here, when people are first starting to learn programming, it's very common for them to write code in Portuguese. For example, they would write this simple age verification algorithm:
int verifica_idade(int idade) {
if (idade < 18) { return -1; }
return 1;
}
int main() {
int idade;
scanf("%d", &idade);
int verificacao = verifica_idade(idade);
if (verificacao < 0) { printf("Acesso negado\n"); }
else { printf("Acesso liberado\n"); }
return 0;
}
Do French (or other languages) speakers also do this?
> Do French (or other languages) speakers also do this?
I don't know anything about the Portuguese script. But your example seems to be made entirely of regular Latin alphabets. Now imagine another language where that isn't the case. Just switching the layout even on a programmable keyboard is going to be a major annoyance. I can touch type on two layouts (English Qwerty and Malayalam Poorna Inscript, in case you're wondering). Occasionally switching between the two layouts is the biggest distraction while typing prose - even with convenient layer switchers programmed in. Programming is going to be hell if the keywords and identifiers are in different scripts. I reckon that it would slow me down to about one-third of my full speed.
There are genuine reasons why identifiers could be in another language - like programming for linguistics (spelling and grammar checkers, morphology analyzers, etc) or while dealing with regional concepts. But even in those cases, programmers simply transliterate it into Latin script, rather than use the original script. Their sound roughly the same. But full fidelity is not possible (there are sounds that you may not have even imagined before). Even so, it's easier to just compromise on fidelity rather than do constant layout switching.
And then there is the reality that many language scripts are simply unusable for programming. My own language is agglutinative - meaning that multiple words fuse into one (even 4 words combining is not unusual). The same thing can be written in a dozen different ways. This isn't a big issue if you're reading or listening. It won't confuse you. But the moment you start applying formal rules like in a computer, it's a dozen different ways to type it wrong! I like my script for anything other than programming. It's very expressive. But the anemic simplicity of the Latin script is actually a big advantage when it comes to things like programming and mathematics. I believe that you will find many such peculiarities and nuances with other scripts if you go searching.
> your example seems to be made entirely of regular Latin alphabets.
Portuguese is a direct descendant of Latin. But it has quite a bit of punctuation, OP just ignored that as the programming language, C, does not support it. In Common Lisp you can happily go:
You could even go all the way:Ah! Yes! I was wondering about the diacritics/accents. How do you deal with those? Do you have to switch keyboard layouts like me, or are they trivial additions to the qwerty layout?
I have 3 different keyboard layouts installed. As I live in Sweden, my keyboard shows the Swedish layout, but I also use both English and Brazilian ABNT layouts and know them by heart.
I have a single key shortcut to switch between them.
Accents work as if I was using a native keyboard, so they're not too bad (unless you're on mobile, there it sucks), except the keys do not show the right symbols. If you don't know the mappings by heart, you can get your OS to show you the layout... maybe leave that on the side and look up when you forget something.
[dead]
Providing a translation in English so people stop downvoting:
Writing programmes in Malayalam is something I've always wanted to do. I know that programming is primarily the language of mathematics, and it's just expressed in English. However, I've felt that seeing it in Malayalam would help in understanding things a bit more easily. At the very least, the documentation would be easier to read. There's no need to use Malayalam script for writing the programme; writing it in Manglish using Latin script would suffice. Only the description needs to be in Malayalam. That way, the problem of changing keyboards would be solved.
I actually didn't have to make any of these comments here as I already have finished with this subject(programming) and moved on. But somehow, when I see a post like this, I did.
Best of luck with your projects. May god bless you all.
Yeah it's quite common in French (for learners). At least in part because French people aren't very good at English, it'd add more friction to the learning process (and even for the ones who aren't bad at english, it's a whole new vocabulary to learn).
I'm not sure when I did the switch myself! Maybe as late as my first professional experience, or maybe a bit later in my studies
Yes we do this while learning programming. Then it quickly becomes a sign of being a novice programmer that we look down on.
Should it be looked down on?
I think so. You don't know who might touch your code later, better to use English than for them to figure out what those words mean. It would be like using giberish for all your variables.
Another issue, even for other speakers of your language, we don't all translate english words the same, some words are just not translatable and some words look the same but mean different things, how can they tell if it was meant to be English or not?
For example in Spanish, "default" translates to "por omisión", two words, there's no single word for it, a lot of people translate it to "defecto" because it's similar but that means flaw, defect. It's so used, people say "por defecto" instead of "por omisión" now and some dictionaries added it as a translation already.
Another example, "cache", I know its meaning in computer lingo, the times I've had to use it is in the context of computers, so I have no idea what its translation to Spanish is or if there's even a word for it. If someone used the translation in code I would have no idea what I'd be looking at.
One more, "library" translates to "biblioteca" but some people use "libreria" (bookshop) because it sounds similar. You can find usages of both in documentation. People will probably understand both but it hurts searchability.
Well. Although this rouille thing is obviously a joke, it's also just a preprocessor macro layer, so it'd be pretty easy to switch to any view of the code. Could write it in "french" then transform it to english, then to russian.. Could also imagine doing that in an IDE without even impacting copy and paste just as a visual layer. Not sure what one would do for that spanish por omisión, but maybe just put an underscore. por_omisión
For another example of this, there was BritCSS someone made that lets you use British spellings in CSS:
https://github.com/DeclanChidlow/BritCSS
If the application domain is country-specific, this even happens in professional programming, because it doesn’t make sense to invent English translations for the local-language domain-specific technical terms. Whenever people do this, the result is non-idiomatic English terms that neither make sense to an English speaker nor to a local domain expert.
People do it and it’s perfectly fine.
There is nothing mandating you have to write things in English. It’s often but not always the de facto common languages between foreigners but it’s just a language.
If you read the code of Chinese projects, it’s very often in Chinese for exemple. They don’t really care about English speakers.
When learning a new computer language, using names in your native tongue makes it easier to tell what's yours and what belongs to the programming language itself.
Now when syntax highlighting is everywhere language separation doesn't give much benefit.