20
\$\begingroup\$

In Sieve prime generator C++, a user translated some French strings into English, and the edit got approved.

In toBase64 encoder, the author replaced Russian strings and comments with English in response to a comment.

What should have be the right thing to do regarding code in a language other than English?

  • Should identifiers be forcibly translated?
  • Should literal strings be forcibly translated?
  • Should comments be forcibly translated?
  • Is it reasonable to demand that the original author do the translation?
  • Should other users edit the code to make it English?
  • Do the answers to the questions above depend on whether issues are explicitly mentioned as a concern in the question?
\$\endgroup\$

2 Answers 2

19
\$\begingroup\$

Stack Exchange in general has an English-Only policy. There are some exceptions for language-specific sites (like Stack Overflow in Portuguese). Code Review is not an 'exception' site.

It is clear that there are benefits and drawbacks to having an English-only policy, but the Stack Exchange 'powers-that-be' have determined that, on balance, the English-only policy is preferable to the alternative.

It is not the purpose of this answer to debate the merits of that decision.

Thus, the expectation is that English is the common language for all posts.

Does this mean that posts should be translated in to English?

No: - to the Code

Non-English code

Changing the code in a question is not an option on Code Review. If the code is unreadable, or not understandable, as a result of the language in the names, or comments, then the post should be closed as "Unclear what you are asking".

The question asker has the option then of re-writing their code in an English format. Unfortunately, that is not something that other Code Review users can do, it has to come from the asker. Once the revisions are made, the question will make its way in to the reopen review queue, as per usual.

Suggested Edits to the actual code should be rejected, and successful edits should probably be rolled-back.

There is only one situation in which the code in the question can be edited by the community in general, and that's if there's an obvious copy/paste or markup management problem that results in the code in Code Review not being representative of the code in the program. No other changes to code in questions are allowed, unless they are made by the original asker, and normally only before answers are given to the question.

Yes: - to the Description

Non-English description

Questions which are not clear as a result of language issues in the description (but have English code), should be closed as "Unclear what you are asking". In this case, though, both the asker, and the general community, can translate the description. If the translation is done quickly, then the close can be avoided, but there is still the possibility of salvaging the question after a close, and having the question reopened.

If you are able to translate a question's description, then you should feel free to provide one.

"Broken" English description

Many Code Review, and Stack Exchange users are not native English speakers. We expect all levels of English competence when people post their questions, and there are many willing, and capable editors who will happily clean up posts that have broken English descriptions.

Your English abilities should not be a factor in the decision of whether you post a question to Code Review, or not. While we strive to present a quality site, in English, we don't expect it to be perfect without some effort from both the question askers, and the people who edit, and improve questions. It's a team effort.

\$\endgroup\$
2
  • \$\begingroup\$ While I agree, it feels like this answer doesn't say anything about whether to translate identifiers, literal strings, and/or comments. What is part of the code and what isn't? Is it all part of the code and nothing should be translated? \$\endgroup\$ Dec 4, 2014 at 21:42
  • 2
    \$\begingroup\$ "There is only one situation in which the code in the question can be edited by the community in general, and that's if there's an obvious copy/paste or markup management problem that results in the code in Code Review not being representative of the code in the program" >.. I thought that was clear... hmmm \$\endgroup\$
    – rolfl
    Dec 4, 2014 at 21:53
8
\$\begingroup\$

Code language is on-topic for review. Finnish/Swedish variable names are hard to type on my keyboard. This makes your code hard to use.

Don't change the code.

Code comment language is on-topic for review. When I'm working with your Chinese API I will understand absolutely 0% of it. This makes your code hard to use.

Don't change the comments.

If someone puts the problem description in a different language, vote to close "doesn't belong on the stack exchange network".

English-only questions.

\$\endgroup\$
2
  • 4
    \$\begingroup\$ +1 for pointing out that code written in other languages is hard to use and a valid point of review. I've mentioned to a few OPs that it may be unfortunate, but English is the standard for writing code, even if a minority of the world's population speaks it. \$\endgroup\$
    – RubberDuck
    Dec 4, 2014 at 14:43
  • 2
    \$\begingroup\$ Screw "majority of world population". Programming is not general communication. Programming is technical. Thus, you'll want to look at the language used in technical areas. That language is English. \$\endgroup\$
    – Pimgd
    Dec 4, 2014 at 14:46

You must log in to answer this question.

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