On a site with several site languages, the search page shows results in the language the visitor is browsing in. A visitor on the German side of your site gets German pages. There is nothing to switch on: it works as soon as your site configuration has more than one language.
How each page gets its language
- The extension prints the locale of the page's site language (for example
de_DE) in the head of every page of your site. The Data Crawler reads it and stores it with the page. Data Ingestion sends the same locale with each language of a page. - Documents with no locale of their own, such as many PDFs, are kept under the language Opensolr detects in their text: Language and locale.
How results are kept in one language
- The search page of each language, such as
/de/opensolr-search, searches in the locale of that language. - When the locale has a country part (
de_DE), results must carry exactly that locale. - When it has none, every country of that language matches.
- Documents without a locale match when their detected language is the visitor's language.
Suggestions under the search box follow the same rule. A page without a translation in the visitor's language is found only through the languages it exists in.
Translations in the sitemap
The extension sitemap lists every language of every page, so the crawl finds every language of your site: The extension sitemap.