DEV Community

João
João

Posted on

How do you deal with naming when you're bilingual?

For those who are bilingual, how do you name your variables and functions? What about comments? Do you only use your mother tongue? Do you mix the languages?

For example: You're Portuguese and use English for all of your projects, but now you have a project that needs to be in Portuguese (only the frontend); what's your plan?

Top comments (20)

Collapse
 
astraldisaster profile image
Leon Oskam

All English, all the time.

You never know who else needs to look at or work on your code at some point in the future, even if it's a solo project. It's a good habit to get into no matter what (and if you're not fluent in English it can also be a good learning experience).

Standard libraries/APIs/keywords are in English anyway so even if you want to write your code in another language, at best it's going to turn into an inconsistent jumble of that language mixed in with a lot of English. I really don't see much advantage to doing this.

Collapse
 
cerqueira profile image
João Cerqueira • Edited

Hey there, Portuguese here too.

I only use English for programming for two main reasons:

  1. It's the "accepted" language amongst most developers because it's more mainstream.
  2. When I write code I like to think that other people (which I don't know where they are from or what their native language is) will probably come along in collaborating, so it's better that it is understandable by everybody (which takes us back to point 1).

Although I'm not thinking about changing this approach, I'd like to know others opinions.

Collapse
 
damcosset profile image
Damien Cosset

French here.

I only use English for variables, functions and comments. I've been used to do things like that. I learn to code with english resources, so it feels more natural to code in this way. Commit messages are also in English. Like Joao said, I think english is universal enough, most keywords are already in english, and clear code doesn't require a high level of english I believe.

The problem that I have sometimes is to come up with good names to describe what the function or variable is supposed to be.

Collapse
 
valentinpearce profile image
Valentin Pearce

I have trouble finding good names in French that are not so long you've forgotten the beginning of them when you reach the end.

I guess it's a force of habit.

Collapse
 
damcosset profile image
Damien Cosset

It honestly feels weird to try to write code in French. It just doesn't feel natural. I suppose it's because I only wrote in English, but it's really strange.

Collapse
 
jerbiahmed profile image
JerbiAhmed

Been in the same case .. Our direction decided to outsource a project to India .. they asked us to translate docs from French to English

Collapse
 
elorz007 profile image
mikel.sh

Spanish here. All english, everywhere, no exceptions (even JIRA tickets, comments, Confluence pages).

The main reason for me is being able to hire international developers. And I find it really important to have a multicultural team because it brings new points of view, alternative ways of doing things and it's just more fun overall. I am currently working in germany and I could join my company effortlessly because they had everything in english.

P.S. If I do a job interview and I see that the company has any code that is not all in english, it is a big red sign for me.

Collapse
 
samrufflecoles profile image
Sam Ruffle Coles

Monolingual Englishman here.

English obviously since it's all I have but, I always use American-English spelling for consistency. Color over colour, center over centre, canceling over cancelling and so on.

I would never do that outside of code.

Collapse
 
feacur profile image
Leonid Kapitonov

Heya!

Native language - Russian;
Code language - English; the only option that makes sense for me;
Comments language - English; I would write Russian occasionally if required, though;

Obvious advantage is being understood virtually worldwide.
Illusive advantage is that sticking with ASCII lifts off text encoding problems.

Collapse
 
datacharmer profile image
Giuseppe Maxia

I am a native Italian speaker, now living in Spain. I am fluent in three languages, but I have always used English for variable names and comments.
Three reasons:

  1. It fits with the flow. Every programming language that I use has English keywords. Therefore using English variables makes the code more readable.
  2. I learned most of the technology that I used from English sources. Using English for coding feels is consequential. Moreover, sometimes I don't even know how a given concept is called in my native language. Thus using English everywhere becomes a necessity, in addition to a point of style.
  3. I contribute to several open source projects, where English is a language understood by most community members. It's a way of keeping the scope of the project as broad as possible.
Collapse
 
nancyd profile image
Nancy Deschenes • Edited

I speak French and English. I always code in English. For work, I have to code in English so others will be able to work on the same code. If I do a quick personal project, I don't even consider doing it in French, because so many of keywords in the language are in English, and when I read code, I read operators in English.

Once, I wrote something in French for a presentation I was doing, and the process was really difficult. When you speak two or more languages and interact with someone who speaks the same languages, you can change between languages easily, even in the same sentence, but there are unspoken "rules" for when you can change. You wouldnt' say, "Le cat est going d'attraper the oiseau red sur the arbre". When I code with French variables, that's how it feels. I spend too much time "code switching" between languages, it's painful:

If la somme is greater than or equal to le minimum requis, then fait quelque chose

Collapse
 
edneypitta profile image
Edney Pitta

Brazilian here.

I only use Portuguese for one main reason: it's impossible to effectively translate specific business domain vocabulary without creating ambiguity and confusion between developers and stakeholders. This is called Ubiquitous Language in Domain Driven Design.

We've tried once to mix languages (Portuguese for domain and English for the rest), but it quickly became a total mess.

Collapse
 
gregorgonzalez profile image
Gregor Gonzalez

I'm from Venezuela, I use Spanish and English between projects.

I use Spanish code for everything, unless the project is for a external company/client that speak English.

Local projects "spanish".

Spanish speakers "spanish".

Mexican projects Spanish for code and frontend "spanish and English" if they needed.

If I work with others I use their language "english or Spanish"

Puerto Rico. Well was really difficult, they use both english and Spanish, I started the code in Spanish but they use specific things on English so I mixed and was an awful code, even databases fields was weird hahaha I didn't know English well when I started the project (I need more practice)

Collapse
 
soul_wish profile image
Sergey Lysenko

I'm Ukrainian.
And I only use English for programming (including commits, comments, docs etc.). Even in my personal pet projects I don't use my native language. English language is really became a standard for development and programming. Who knows, maybe my code will be useful for anyone (and I'm sure it would be more convenient to that person to read my source files in English). 😉

Collapse
 
sas profile image
Sven A. Schmidt

There are cases when either can lead to difficulty but I've found that going for English only is the least weird and the most future proof. You never know when and by whom it will be read.

One example I've experienced where English was a tough choice was implementing a banking system with very specific German domain language. We came up with lots of rubbish English translations that a professional translator would probably have found hilarious but since none of it was customer facing we just ran with it.

Collapse
 
karreg profile image
Karreg

French here.

I use english only, since you never know who will work on your code, it could be outsourced in India, shared with another team in NY.

However, we also have some regulations when working with government departments, where french is mandatory in a lot of things (documentation for example) that have impacts in code too (comments for example).

Collapse
 
valentinpearce profile image
Valentin Pearce

I'm half French half British but French is my mother tongue since I've grown up and lives in France most of (practically all) my life.

I tend to write all my code in English with the exception of assignments that require a naming convention that is in French.

There is one situation where I will write code in both languages though.
I'm currently working on a website with CodeIgniter and the front end is in French. I use names in English for the whole backend code but use French for the frontend.

That is part of the assignment but I find it also helps when debugging because I then know where the bug is.

Collapse
 
gionaufal profile image
Giovanni Naufal

I'm Brazilian. My naming style consists in doing almost all in English, except of course when messages need to be shown to users in Portuguese.

But it's common in some (smaller) companies to name variables and classes in our native language. I've seen this cause a lot of issues when a company that I worked was bought by another from the US, making it necessary to "internationalize" the code.