Same issue, same user, different SO question: Problem with Google translating Stack Overflow

The language policy of the SE network is basically "We use English". However, this assumption is sometimes subverted by automatic translation systems:

Today, a user posted an answer (now deleted) in Portuguese; after my comment "please post in English, thanks", added another answer (also deleted):

Well I don't understand why this site appeared to me in Portuguese, so nobody needs stupied ok. I'll delete all the questions and answers

I'm guessing this is an artifact of Google Chrome (which has automatic page translation enabled by default), or a search result proxied through Google Translate. I assume the user must have been terribly confused when she saw my request to use English, on a site which (from her POV) was written in Portuguese.

Do you think SO should show some sort of notice for the users if they're getting the data through an automated translation service? (Is it needed? Do users read?)

(I've searched the Meta, and this seems somewhat relevant: Is English required on StackOverflow; but I'm not sure what to make of this Babylonian issue, except maybe to get a "No Elephants" sign)

Update: it seems more users are experiencing this, and it's not getting any better.

  • 1
    I don't think it's really urgent: This is one of the first times it's happened.
    – Pekka
    Aug 31, 2010 at 13:36
  • 1
    Related: meta.stackexchange.com/questions/62933/…
    – Pekka
    Aug 31, 2010 at 13:37
  • @Pekka: Same user, different question. (Cannot vote to close on MSO, but my question is clearly a duplicate.) Aug 31, 2010 at 13:38
  • 3
    Its actually also because SO deliberately breaks iframes, thus except for a single first alert Javscript warning the Google Translate interface gets totally removed, and the user will have no more indication (except for the exceptionally bad language) that he's actually viewing a translated version. If you haven't already, try clicking on @waffles' link on the question @Pekka posted
    – Yi Jiang
    Aug 31, 2010 at 13:41
  • 1
    @Piskvor, you're right that you asked a dupe... but the other question already has a close vote on it, and I'm going to add to it, because your question is objectively better.
    – Pops
    Aug 31, 2010 at 13:59
  • Also, correction @Pekka: "one of the first times we've seen it happen." Aug 31, 2010 at 14:56
  • I believe this is the third time (in two years) that I've seen this happen.
    – user50049
    Jan 25, 2011 at 2:47
  • @Tim Post: It happens more often (quick editing obscures it somewhat), and I think this won't get any better. Some of the content-reusing sites (i.e. "use the SE data dump") provide automatic "translation", which may lead users to believe non-English content is OK on SE itself. Jan 25, 2011 at 9:30
  • 3
    As per google faq: If you're a webmaster and would prefer your web page not be translated by Google Translate, just insert the following meta tag into your HTML file: <meta name="google" value="notranslate"> translate.google.com/support/?hl=en Feb 1, 2011 at 17:46
  • 2
    @belisarius: Hmmm, now that's new (for me) and interesting. Then again, SO is a Q&A site, so translating existing content is not a real problem; that comes up when a user tries to post in another language. Perhaps that tag could be on the "ask a question" page? Hmmm... Feb 1, 2011 at 17:52
  • @Piskvor I'm not posting it as an answer, because I didn't test it. As with all meta tags, I expect it to have some quirks. But seems an interesting starting point for trying to do something to alert users about the issue. I guess however, if the user doesn't speak English, the only way is in his/her language :D Feb 1, 2011 at 17:57

6 Answers 6


Maybe a better idea is to warn users if they are writing a post in a language that doesn't appear to be English.

Of course this is technically difficult to do, but google seems to be able to do it extremely well and I'm sure you can find on the internet all sorts of algorithms that you can use.

If it thinks that the post is not in English, it could say:

It appears that you are writing a question/answer in a non English language. Please keep in mind that Stack Overflow is an English only website, and therefore all posts should be in English.

Of course it would simply be a warning; the user will be able to post it anyway if they so choose. Something similar to "Your question appears to be subjective".

  • 2
    Interesting, but a large part of my answers isn't, technically, written in English, but in programming languages. Wouldn't that trip up the recognition? Oct 26, 2010 at 22:14
  • 1
    @Piskvor: it wouldn't because it would be trivial to skip code blocks. Also I'm pretty sure the algorithms work by splitting down your text in a percentage of various languages; if it thinks it's 10% english and 90% gibberish (code) then it will say it's in English. Oct 26, 2010 at 23:50
  • 3
    This would of course have the accidental advantage of throwing out 80% of the questions that are asked; those in various combinations of l33t and lazy.
    – Rosinante
    Oct 27, 2010 at 0:48
  • @Kop: Nicméně SELECT * FROM some_table WHERE column LIKE '%bar%' vypadá povětšinou anglicky. In other words, English is at a disadvantage here, as many programming languages use English words as their keywords. You'd have to implement some sort of stoplist for those. Nov 23, 2010 at 16:27
  • 2
    Check for stop words in different languages. Stop words are common enough to be able to distinguish between two languages (most answers will have at least 2). However, some stop words are common to multiple languages...... Jan 25, 2011 at 2:42
  • 4
    Imho, any text contained in code blocks should be ignored because code is usually already in english anyway indeed.
    – wildpeaks
    Jan 25, 2011 at 2:48
  • 1
    Newbies (who are the ones affected by this problem) don't always know about code-blocks, and do not format their code.
    – Blorgbeard
    Mar 4, 2011 at 14:00

Some asides:

  • To stop Chrome (and Chromium) from offering translations, one could use <meta name="google" content="notranslate">. (Obviously not very user friendly!)

  • For partial blocking: class="notranslate" could be added. (Maybe the main interface could be forced to always be English then? Like an English "Ask question" page implicitly states we're expecting English?)

  • After Chrome has finished the translation: <html class="[...] translated-ltr">, or translated-rtl when translated into a right-to-left language such as Arabic. This makes unhiding a warning message easy. And that message will probably have been translated as well! Like so:

    Example of warning for translated content

  • I doubt any of the above would apply to other browsers too.

  • Instead of adding a class, the Google Translate web site changes <html lang="nl"> into lang="en-x-mtfrom-nl", where obviously the first en is different for other target languages. I am not sure if all browsers support the CSS3 partial [lang$='-x-mtfrom-nl'] selectors?

So, the following CSS detects translations for both Chrome and the Google Translate website:

#warning { display: none; }

.translated-ltr #warning, .translated-rtl #warning, 
  [lang*='-x-mtfrom-'] #warning { display: block; }

To detect the language of new user input (in any JavaScript-enabled browser), the Google Translate API offers the detect method (but might need code blocks to be filtered out first). Due to abuse, the free version has been deprecated since May 2011, but Google stated that a paid version might be introduced. The free API required displaying attribution near any API input boxes and the display of results, indicating that it is "Powered by Google", but it seems that using detect (in the paid API) might not require that?

  • 1
    Note that Google Translate API is now deprecated, and will be shut down later this year. Jun 10, 2011 at 19:45

I don't want to sound mean or something - I'm not a native English speaker myself - but I don't see how is this SO's problem. If users are browsing the internet using any external translation tools, they should be aware of those. Every website where users can submit content to can potentially be viewed as if it's in the wrong language...

Of course, there's a difference between being right and being smart. If there's a very large amount of these cases, I suppose it's worth adding some sort of language detection to the text areas - it's just that I have a hunch this is not computationally cheap.

Alternatively, if there's a problem with a specific country or two, maybe a simple work-around could be to display an unobtrusive image with the text "please use English only" whenever an unregistered user who identified to be from one of these countries (by IP) tries to post a question or answer.

  • So far, I've seen German, Portuguese, French, Russian, and what I think were Vietnamese, Hindi, Chinese, and Japanese. Not really enough datapoints for any single language to be significant. You are right that there's not a whole lot of these cases - there are indeed other, more frequent problems - but they do happen often enough. Feb 1, 2011 at 17:38
  • 1
    "... they should be aware of those." The problem is that SO makes the thing that makes them aware of it (the bar on top of your browser) go away. I don't know how exactly, it has something to do with iframes, but as I understand it, it's something SO can fix, so that bar doesn't disappear.
    – fretje
    Mar 4, 2011 at 14:30

Perhaps it would be beneficial for this having a carefully worded warning on the top (or other noticeable location) for hits coming from search engines or perhaps users not logged in stating that the use of the English language to communicate is required. Carefully worded so any translation engine can translate to the appropriate language then no matter what, there will be a message that the user would be able to understand.

IIRC, there's already a header that says that it is a Q&A site for programming enthusiasts. Maybe add or adjust it to include "where communication using the English language is required" or similar. Though I have my doubts on whether it would be considered acceptable however since this is not a very common situation.


I don't know how Chrome internally handles the translation, so I wonder, could SO properly detect that the page has been translated by the client-side browser ? This might not be reliable and other browsers might also offer this feature using different methods (Firefox plugin or mobile browsers for example ?).

Therefore I think detecting the language when the user writes a question/answer/comment is the most reliable and future-proof, a fortiori as it's the only moment where it matters to point out that the real contents are in english, not when reading other users' questions/answers.

  • Chrome sends the current URL to Google Translate's server, which checks and returns the probable language. For webpages, this is easier, as the page is probably in Google's caches; for user input, this approach would require sending it to a translation server - which brings up possible privacy issues. Maybe doing a frequency analysis at client-side could get us a reasonable guess (but then you'd need to load frequency data for all the languages you'd check - this was the method IE used (uses?) to guess character encoding). Jan 25, 2011 at 9:14
  • @Piskvor, for Chromium, the process is documented differently. Like: the renderer extracts the text from the page and detects which language it's in.
    – Arjan
    Feb 1, 2011 at 18:47
  • @Arjan: Interesting...is this Compact Language Detection your link mentions somehow reusable? Feb 1, 2011 at 21:22
  • @Piskvor, yes, I think so: src.chromium.org/viewvc/chrome/trunk/src/third_party/cld See also some details at globalbydesign.com/blog/2010/12/06/…
    – Arjan
    Feb 1, 2011 at 21:31
  • @Arjan: Hmm, so it seems Chrome has independently arrived at something similar that IE had for character encodings. Could be useful, yes. Feb 1, 2011 at 22:30

I'm going to buck the trend and say let's roll with it.

We should implement language detection, and if a post appears to be non English, use the google translate API to convert it to English and store the translated version in the DB so we only have to translate it once.

It won't be perfect, it may be annoying, but with the addition of a little note that says it was auto translated I believe users will be able to do well with it. Automatic translation has improved by leaps and bounds in recent years.

If we do get an unusually large flux of users in any given language, then make it easy for users to choose whether they want to see translated questions or not.

Yeah, there will be problems and growing pains, but let's consider embracing it rather than dismissing it out of hand. The reality is that more and more people will be using automatic translation to read SO, and while we can put up barriers and warnings, I think everyone will be better off with an inclusive policy, rather than exclusive one.

  • Have you seen the Stack Exchange Translation Project question? ( meta.stackexchange.com/questions/59298/… ) My position in brief: 1) There is no automatic translation IRL (as opposed to sci-fi; it's always been "five years in the future" since the 1960s, like flying cars). 2) automatic word-for-word transcription ( for that is what we have ) turns even sensible, gramatically correct input into 99% noise. 3) therefore, it will turn clueless questions with questionable grammar in a different language into 100% noise in English. Jan 25, 2011 at 8:45
  • @Piskvor I see your point. I have recently been getting reasonable results from google translate, but if it's still that bad then it is not reasonable to consider as an option.
    – Pollyanna
    Jan 25, 2011 at 12:07
  • @Pollyanna: The quality varies a lot - they have a dictionary backend and a crowdsourcing "suggest a better translation" option, so the result depends also on the popularity of a given translation (fr->en could be popular, aa->gn not so much). For a very rough translation from a reasonably coherent text, it sort of kind of works, but there's a lot of additional effort required from a human reader to grasp the meaning; in our case, I'm afraid it would be another drop to the bucket of "I'm just going to mash the keys for a while; I expect you people to read my mind, and gimme teh codez!" Jan 25, 2011 at 12:26
  • Another thought I had on the "inclusive policy": There's a scarce resource: editor time (where "editor" is anyone who edits questions to improve them). In my opinion there isn't enough editing as it is, and adding translation into that might be too big of a bite for the site to swallow. SO's policy is IMHO very inclusive, but "inclusive policy" is not a goal in itself, nor is it good by itself (else there wouldn't be "close as off-topic", SU or Programmers.SEx, all of which are direct results of "this is to be excluded from SO"). Jan 26, 2011 at 9:44
  • 1
    I am really hoping this was posted ironically Feb 1, 2011 at 17:37
  • What about a translation queue where users can manually translate and gain rep for thier efforts?
    – Moshe
    Feb 7, 2011 at 18:08
  • 1
    @Moshe - English is the lingua franca of programming. The majority of programming languages are in english, and the majority of programming documentation and knowledge is in english. While trying to help people in their native tongue would be nice, the reality is that we need to focus on doing one thing well, rather than attempting to be everything to everybody.
    – Pollyanna
    Feb 7, 2011 at 18:22
  • 1
    @Moshe - I think the real problem with opening the flood gates to alternate languages is that many people who are now posting in english well enough to get answers would prefer to post in their native language and let others do the hard work of translation. We wouldn't simply be helping those that cannot speak english - the majority of the translation work would be done for those who are merely uncomfortable with their english skills. It would be better for them to post in english and learn, rather than providing a poor crutch.
    – Pollyanna
    Feb 7, 2011 at 18:24
  • @pollyanna true.
    – Moshe
    Feb 7, 2011 at 20:34
  • 2
    @Pol: This might be true for programming, but as we have the StackExchange network now, I think translation or internationalization of this a Q&A website will be a very important topic in the near future!
    – fretje
    Mar 4, 2011 at 14:38

You must log in to answer this question.

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