Search...
language( )
Refines a search builder to search in the specified language.
Description
The value of the search language must be a two-letter language code string of ISO 639-1 format.
Defaults for language
:
- If your site is multilingual, default is the current language.
- If your site is not multilingual, default is the site language.
Syntax
function language(language: string): WixSearchBuilder
language Parameters
NAME
TYPE
DESCRIPTION
language
string
The search language.
Was this helpful?
Add a language filter to a search
Copy Code
1let newSearch = search.language("fr"); // French
Create a search, add a language filter, and run it
Copy Code
1import wixSearch from 'wix-search';23// ...45$w("#searchInput").onKeyPress((keyPress) => {6 if (keyPress.key === "Enter") {7 const phrase = $w("#searchInput").value;8 wixSearch.search(phrase)9 .language("pt") // Portuguese10 .find()11 .then((results) => {12 if (results.documents.length > 0) {13 let documents = results.documents;14 } else {15 console.log("No matching results");16 }17 })18 .catch((error) => {19 console.log(error);20 });21 }22});