Today I came across this post, where all the variable names were in Slovak. Obviously, when the variables are named in Slovak, it's difficult to figure out what the logic is.

Before posting this question, I found this post that mostly answers my question; except the question itself was in English, just the variable names were not. This post doesn't answer my question either, because if you remove the non-English content, there's no more code.

In this particular case, I translated the variable names to English, which may also have been the wrong move, but I wanted to know what to do for future reference.

  • Does this answer your question? Should we attempt to salvage non-English questions?
    – M--
    Commented Apr 13, 2020 at 21:16
  • See: meta.stackoverflow.com/q/377288/3648282 and meta.stackoverflow.com/q/266563/3648282 - The OP should do it, you don't have to, you could do it. Don't translate (and bump) old questions unless they are particularly useful and aren't going to go stale-dated in a short period of time. The "what to do" for programming is usually answered on SO's meta, but asking here is OK (in this case). The proposed dupe is for 'general translation' of an entire post, not specific translation of variable and subroutine names.
    – Rob
    Commented Apr 14, 2020 at 2:39

2 Answers 2


I wouldn't touch them.

From a technical perspective, this would result in equivalent code at best. At worst, it could cause accidental changes in meaning and/or behavior.

From a reader understanding perspective, this could make the OP's intent somewhat more clear, assuming that the OP selected sensible variable names in his native language in the first place. However, it could just as easily reduce the usefulness of existing comments/answers that refer to the old names.

Changes also run the risk of confusing the OP, who might not understand the English names. Heck, I get thrown for a loop sometimes when my variable names are changed from English to English, and my English skills are quite good (in my not-at-all-humble opinion).

You could achieve all of the pros with none of the cons by posting a list of translations in a comment, or maybe in the question body underneath the code snippet.

  • +1 for adding a key of translations.
    – Servy
    Commented Dec 5, 2012 at 19:53
  • Yeah, that's what I should have done. I didn't think of it. Thanks @PopularDemand
    – durron597
    Commented Dec 5, 2012 at 20:02
  • Generally in programming, variables names mean nothing. A good programmer should be able to tell what's happening without knowing what the variable "translates" to, especially in the example provided. So, from that perspective alone, I see no reason to edit the variable names.
    – animuson StaffMod
    Commented Dec 5, 2012 at 20:19
  • @animuson I usually can tell, but it takes more effort - I have to figure out what something's for, not just immediately knowing. The question is much less useful if people have to figure out what variables mean before they can understand the post.
    – durron597
    Commented Dec 5, 2012 at 20:22
  • @animuson I think that applies much more in the professional world than on Stack Overflow. When you're looking at a small, possibly non-compiling piece of a program on a question that provides only minimal or incomplete context, good names can be pretty helpful.
    – Pops
    Commented Dec 5, 2012 at 20:27
  • @animuson wrote "A good programmer should be able to tell what's happening without knowing what the variable 'translates' to." Maybe, if the code isn't too sophisticated, but most importantly, only if the code works. This is less of an issue for code that makes heavy use of a common API, but a broken algorithm in a foreign language is incomprehensible.
    – arx
    Commented Mar 3, 2013 at 14:23
  • 1
    @animuson "Generally in programming, variables names mean nothing." I strongly and totally disagree. If your statement were true, you could code with variables names like "a, b, c, d, e". And from there, let's name your functions f1, f2, f3, f4 (and so on, on classes, files...). The difference between a sensible, explicit and non ambiguous name and one chosen with less care is often one or more bugs added at first write, or on further edits or even refactors.
    – Guillaume
    Commented Jul 30, 2013 at 21:56

I think that's ok, but there are a few caveats:

  • Make really sure you're not introducing bugs with the renames.
  • Make really sure you're not fixing bugs with the renames.
  • Check the answers – they are going to look real strange if they reference the original names that the question doesn't contain anymore.

So you better be fluent in both the natural and programming languages of the question.

If you don't have full edit privileges, I'd say avoid it unless it is completely trivial - these things are hard to check unless the code snippet is really trivial (and if it is, it probably doesn't need fixing anyway).

  • I do have over 2000 reputation on SO. Interestingly, there was one answer that was using the old variable names, but it was written while I was making the change and has since been deleted.
    – durron597
    Commented Dec 5, 2012 at 19:33
  • 5
    There's one other major thing you have to consider here: by doing so, you may be forcing the OP to translate them back in order to implement any solution into their program, especially if it was only a snippet out of a larger program.
    – animuson StaffMod
    Commented Dec 5, 2012 at 19:45
  • 1
    I think value to future visitors (including potential answers) trumps that. OP will hopefully get his problem fixed - and extra translation back to his own language shouldn't be too bad.
    – Mat
    Commented Dec 5, 2012 at 19:49
  • @animuson Thankfully most IDE's have a refactor mechanism that makes that easy(er), and they still have their original code to compare with their edited OP to see what translates to what.
    – Servy
    Commented Dec 5, 2012 at 19:54
  • @animuson But no sane programmer uses non-English variable names in production code, alrite?
    – H2CO3
    Commented Aug 7, 2013 at 15:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .