Hacker News new | ask | show | jobs
Ask HN: Can the `lang=“en”` attribute interfere with the text content in Chrome?
1 points by fmoronzirfas 2209 days ago
We had a wired situation and I would love to get some input from others if they encountered something similar.

We released a React application two weeks ago and had some great feedback on the project. Several newspapers wrote about it, we also had some online coverage, many visitors and also users who signed up.

The wired thing was, that about 1.5 weeks later a journalist wrote about the project and he complained in his article that our language was really bad. He pointed out two sentences. In one the German word "schnapp" (means grab) was exchanged for "Schnaps" (which is booze) and another one where "Gründen" was changed to "gehören".

I did some review of the source file and we never had these words in our git history of the file. He told us that he is using Chrome (no version mentioned). The only thing out of the ordinary was that we had in our markup the lang attribute set to English `<html lang="en">`. After changing only that one attribute to German he reported to us one day later that the issue was fixed.

So the only thing I can think of is some Chrome translation or auto correct feature or plugin changing the text from German to German.

Did anyone ever encounter something like this?

2 comments

Yes, If text is lang is EN and browser is DE, translate is fired. You can disable this.

"When Google recognizes that the contents of a page are not in the language that the user is likely to want to read, Google often provides a link to a translation in the search results. In general, this gives you the chance to provide your unique and compelling content to a much larger group of users. However, there may be situations where this is not desired. This meta tag tells Google that you don't want us to provide a translation for this page."

<meta name="google" content="notranslate">

https://support.google.com/webmasters/answer/79812

The text itself was DE. The lang attribute was set to EN. I don’t know what language defaults his browser has. I assume DE. I thought Chrome was smarter then relying on this one attribute for translation…
I suppose it's this, https://www.howtogeek.com/407924/how-to-turn-translation-on-... he has a German Google Chrome, your page said it was English, he has set it to automatically translate from English to German at some point in the past and forgot about it, or his company does it and never told him.
I tried to replicate this scenario on Browserstack but that didn't work. The content of the page is in German. The Chrome built in translation showed the language as unknown. Also most of the text seemed right he only pointed out these two words.