DEV Community

Cover image for Other languages than English in code
david duymelinck
david duymelinck

Posted on

Other languages than English in code

The reason I write English variable, function and object names, is the same reason I'm learning at least a few words in the language that is spoken in the country I'm traveling to. It is respectful and it creates less friction.
But there are also people who don't like that I butcher their language.
Machines don't care about the words, so why am I writing everything in English?

Bounded language and clean architecture

One of the pillars of clean architecture is to write understandable code. The native language is for most (all?) people more understandable.

With domain driven design the bounded language of a domain is important. And some of the terms are best expressed in the native language.

Is this enough reason to change the names from English to the native language?

Public versus internal

It seems normal to default to English when the application needs to communicate with other systems, because we are using programming languages and systems with English terms.

This means the English names could be pushed to the edge of the application. Would it be beneficial to have a language divide between the names we give functionality and the terms of the programming language?
Keywords for the language will have no meaning when written in the native language.

Is it a good idea to write names in a native language that runs on a users machine? I'm thinking about JavaScript, because that is the most used language where the code is public.
Of course with compiled languages this isn't a problem, because the code is not as easy to read.

Programming languages

As far as I know only esoteric languages like BrainFuck don't have English terms as keywords.
Even Go that is build to be as simple as possible has English terms.

The one thing that could complete with English as most universally understood are emoji. There are attempts like Emojicode. The problem with emoji is to find the ones that have the most universally understood meaning and bind that to the language functionality.
▶️ 💬 'hello world' ⏹️ I think the most problematic emoji is the speech bubble.

AI

Will code generation and spec-driven development make it easier to use native language names in code?
I even write prompts and specs in English, while for an AI there should be no problem to read them in any native language.

Your thoughts

Is English holding you back to write the most understandable code possible?
How would you communicate if English is of the table or only used sparsely?

I know the dev.to community is an international bunch of people, and many don't have English as their native language.
I would love to see comments of cases where you really wanted to use your native language. And please include the native language sentences/terms.

PS: The AI generated image always produced a mix of words and just noise, I gave up after ten tries to get a decent result. Maybe AI isn't ready for native language names.

Top comments (7)

Collapse
 
ingosteinke profile image
Ingo Steinke, web developer • Edited

Valid cases for native language are special complicated requirements that can't be explained consisely when there is no English equivalent. Legal and cultures terms, as well as concepts specific to a brand or product. I used to struggle to translate the German "Inbetriebnahmeprozess" which meant a specific set of things to to shortly before and after going live with a new web project. I guess every company or institution develops something similar especially when their processes get more complex and involve a lot of people.

I remember Office macro scripts used to be localized (and hopefully stored as agnostic tokens internally) to match the operating system's natural language. I guess we're lucky that several of those words like THEN have been replaced by abstract symbols like colons, brackets and braces in most modern programming languages.

Still, there are enough built-in English words, some of which with their etymological history dating back to Arabic, Greek, and Latin, so that using any other language for variables, functions and file names feels like breaking consistency unless we do it for a very good reason.

Collapse
 
ingosteinke profile image
Ingo Steinke, web developer

P.S. the 🍌 AI-generated artwork can get boring soon, unless you come up with an unusual creative prompt and a more elaborate description preventing the AI to put a vintage desktop computer at the center of the image.

Collapse
 
xwero profile image
david duymelinck

Yes I'm finding that out now. I agree it is a bad image, but it gave me the opportunity to take a little stab at AI generation.

Collapse
 
embernoglow profile image
EmberNoGlow • Edited

In fact, every country has tried (Not always successful) to create their own programming language based on their native language, and in my opinion, they were very inconvenient to use. For example, the biggest problem is the "{} [] : ;" symbols—to type them, you have to constantly change the language on the keyboard! It's incredibly inconvenient. If I were writing in such languages, I'd have to press Shift+Alt a number of times equivalent to lines of code * 2, and that's a lot of useless work.

Collapse
 
xwero profile image
david duymelinck

I wasn't thinking about countries or identity, when I was writing the post. It is more about the best way to communicate with each other in a code language.

I agree that symbols can be a problem, that is one of the reasons I think languages use keywords.
A solution for your problem can be a keyboard with programmable keys. Maybe not for all the symbols, but at least for the ones that you need the most.

Collapse
 
sylwia-lask profile image
Sylwia Laskowska

I can share my thoughts on using different languages for variable names. In my projects I use English 100% of the time, because the team is often international - all it takes is one person who doesn’t speak Polish. However, I’ve heard that in government institutions, banks, or projects with very specific and complex domains, developers often use variable names in the local language. The business terminology can be so difficult that coming up with English equivalents would make things even more complicated.

Collapse
 
xwero profile image
david duymelinck

I agree it is not always possible to use your native language in code.