113.1. Declaring search engines

Search engines are normally declared using OptionsPreferences, Web Search section in XMLmind XML Editor - Online Help.

Alternatively, search engines may be declared in system property WebSearch.services. System property WebSearch.services must contain search_engine_name/search_engine_URL pairs separated by newline characters. Open lines are ignored.

When search engines have been declared in both the user preferences (that is, using the Preferences dialog box) and system property WebSearch.services, those declared in the user preferences supersede those declared in the system property.

When this system property is missing, this is equivalent to having the following property configuration element in your customize.xxe file:

<property name="WebSearch.services"><![CDATA[
Google
https://www.google.com/search?q=${searched}&hl=${locale2}&lr=lang_${lang2}

Google (phrase)
https://www.google.com/search?as_epq=${searched}&hl=${locale2}&lr=lang_${lang2}

Wikipedia
https://${lang2}.wikipedia.org/w/index.php?title=Special%3ASearch&search=${searched}&fulltext=Search

TheFreeDictionary
https://${lang2}.thefreedictionary.com/${searched}

Wiktionary
https://${lang2}.wiktionary.org/wiki/${searched}

Google Translate
https://translate.google.com/?q=${searched}&sl=${lang2}&tl=fr1
]]></property>

1

The above URI translates some text to French (&tl=fr). If you want to specify another target language, simply replace the language code for French, fr, by another language code. For example, Italian: https://translate.google.com/?q=${searched}&sl=${lang2}&tl=it.

The following variables are substituted in search_engine_URL:

VariableDescription
${searched}Searched text.
${locale}The language of the user interface (GUI) of XXE.
${locale2}Same as ${locale}, but just the first two ISO 639-1 letter codes. Example: if ${locale} is fr-CA, then ${locale2} is fr.
${lang}

The language of searched text. This language is automatically determined as follows:

  • This language is the value of attribute languageAttribute of the spellCheckOptions configuration element in XMLmind XML Editor - Configuration and Deployment.

    When languageAttribute is not specified, the attribute lookup uses xml:lang.

  • When the searched text is the selected text, the lookup starts at the element containing the caret.

    When the searched text is specified in the parameter of the command, the lookup starts (and ends) at the root element of the document.

  • If the attribute lookup didn't give any result, the language used here is the value of attribute defaultLanguage of the spellCheckOptions configuration element in XMLmind XML Editor - Configuration and Deployment.

    When attribute defaultLanguage is not specified, the language used here is taken from field "Default language" of the "Check Spelling" dialog box in XMLmind XML Editor - Online Help.

${lang2}Same as ${lang}, but just the first two ISO 639-1 letter codes.

The value of a variable is automatically escaped if needed too. For example, "vin rosé" becomes "vin%20ros%C3%A9".