1

I just opened a local HTML file on my disk in Google Chrome. Chrome detected the language the file is in and asked me whether I want to translate it.

The document has no lang attribute. It contains some Hungarian text, Chrome offers translation from Hungarian.

Here is a small file that causes Chrome to offer translation dialog:

<!DOCTYPE html>
<html>
<body>
Tudományegyetem
</body>
</html>

I think this is weird. Does the Chrome send my local files to google for language detection?

EDIT OK, now we have a truly minimal file. I deleted "Eötvös Loránd" (a Hungarian name), and kept a single Hungarian word, that means "university". There is a single accented char in the page now, namely "á" -- Unicode U+00E1 (I use UTF-8 locally). This character is not unique to Hungarian language; it is used in many languages. Chrome still detects Hungarian language.

4
  • 1
    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Commented Jun 12, 2023 at 9:47
  • 1
    To give an answer we would need to see this HTML file.
    – harrymc
    Commented Jun 12, 2023 at 9:50
  • 2
    Well, at least the <head> part. You can change domain information to mask it if you like. Commented Jun 12, 2023 at 11:17
  • 1
    @Destroy666 Yes, it does. Wow, a neural network! Amazing. Yes, I believe it is possible to recognize that a word like that is Hungarian. Commented Jun 13, 2023 at 14:50

1 Answer 1

2

Usually the HTML page language can be determined by checking the lang HTML attribute. You can find an additional information here: Declaring language in HTML

The lang attribute is a Global Attribute, and can be used on any HTML element.


For example, in the Google CHROME right click on the page and select View Page Source. In opened HTML page look up for something like <html lang="en": in my case it was English. If no language specified the default language English is used.

Therefore, there is no need to send a file to the server to determine the language.

1
  • I have added a small example in the question. Commented Jun 12, 2023 at 20:10

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