Why does language detection specify the wrong language?
Q. Why does automatic language detection specify the wrong language?
It can happen that the automatic language detection identifies a page as containing the wrong language. Sometimes a page can contain a snippet in another language, resulting in an Accessibility error (screen readers cannot identify language, and so it should be specified within the code).
Some steps to take are:
-
Make sure that the scan is set up for the correct language:
-
From the Domain Overview (Globe icon) click Admin Settings (the gear icon) at the top of the page. The Admin Settings page opens.
Note: The Settings button is only available to site admins.
-
Click Action. on the same row as the domain to scan.
-
Select Edit Domain from the drop-down list.
-
Locate Language in the Domain Details section.
-
Click the drop-down arrow and select the language for the domain scan. Select the primary language for the domain.
Additionally, in the Crawl Options section, make sure that the Use Language Attribute switch is turned to ON.
For more information, see the user guide article:
Configure Domain Scans.
-
Another Language: Words on a page that are written in another language are usually tagged as misspelled words. For instructions on how to repair the HTML code for this Accessibility error, see the HTML School site (external link).
-
Language Detected: Click a page URL and scroll to the bottom of the Dashboard to the Crawl Information section. Check that the language detected is correct.
Another solution is to turn ON the Use Language Attribute option in domain setup.
-
Click Admin Settings (the gear icon) at the top of the domain overview page. The Admin Settings page opens.
-
On the same row as the domain to scan, click Action.
-
Select Edit Domain from the drop-down list.
-
The Edit Domain page opens.
In the Crawl Options section:
-
Use language attribute: Toggle the switch ON. When this feature is enabled, the scan does not try to auto-detect the page language. This means that the spellcheck is only done for the language that is specified in the lang attribute.
The Use Lang Attribute feature helps the scan to do the spellcheck on HTML pages that contain multiple languages.
<html lang=en">
<head>
<title>Hello World in other languages</title>
</head>
<body>
<h1>Hello World in other languages</h1>
<p>
Spanish: <span lang="es">Hola Mundo</span><br>
Danish: <span lang="da">Hej verden</span><br>
French: <span lang="fr">Bonjour le monde</span>
</p>
</body>
</html>
Remember: When this is enabled, the scan does not auto-detect the page language. For example, spell checks are always done for the language that is specified in the lang attribute.
Did not find what you were looking for?
If this content did not answer your questions, try searching or contacting our support team for further assistance.