Even though I’m not a native English speaker, I try to keep my code written in English as much as possible. When in a project where domain specific words and phrases are non-English, I often find myself pulled between translating the word and just using the non-English word in my code (variables, method names, class names etc.).
Translating the word would make the code read more like plain English, with the downside of confusing someone who is accustomed to the non-English word/phrase. Not translating gives you awkward looking names, but they are easier to understand for those familiar with the domain. Aesthetically it makes me cringe a little.
An example of the latter would be something like getVirksomhet() where the Norwegian word “virksomhet” translates to something like “business unit” in English, but also has a special connotation in this particular project.
What do you do, and what are your thoughts on this?
I have worked several years with the most funny translations (from Dutch to English) doing exactly the same that you do: stick as much as possible to English.
However, it creates more confusion than being really usefull (Not to mention the fact that you have to actively manage the “correct translation” otherwise all kinds of minor variations might show up in local variables, counters etc.).
So unless you have some plans to offshore your development soon, I would stick to getVirksomhet() because you all know what it means.
I also worked with some non-native-Dutch programmers andthey had no problems whatsoever in working with the Dutch equivalent of getVirksomhet() etc.