109.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
http://www.google.com/search?q=${searched}&hl=${locale2}&lr=lang_${lang2}

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

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

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

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

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

1

The above URI translates to last selected target language. If you want to explicitly specify a target language, use for example: http://translate.google.com/?q=${searched}&sl=${lang2}&tl=${locale2}.

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".