Every shortcut belongs to exactly one namespace. Namespaces allow the same keyword to be used for different shortcuts – according to the user's language, location or personal setup. This comes in handy e.g. for multi-country websites like Amazon:
a shakespeareshall search Amazon for books from Shakespeare – but Amazon from which country?
Thanks to namespaces, we can have the keyword
- in the US country namespace
- as also in the Germany namespace
Depending on the country in your settings and thus the namespaces you use, the correct shortcut for Amazon will be picked.
But even more: You can also override shortcuts: For instance, while all other users use the keyword
g for Google, you might use it for something else – with your user namespace.
Namespaces work well together with Includes, especially for dictionaries.
|2 chars, by ISO 639-1
|shortcuts related to a particular language
mw tree (from en)
|dot and 2 chars, by ISO 3166-1 alpha2
|shortcuts related to a particular country
|Deutsche Bahn Fahrplanauskunft:
db berlin, hamburg (from .de)
|dcm (dict.com), lge (Linguee)
|3 chars, by their abbreviated name
|shortcuts from a dictionary website
en-<$language> tree (using
language variable from settings)
|a GitHub username (can be overridden with a custom name)
|custom shortcuts created by a user in their repo
|Trains from my home station:
|the shape of the planet
|shortcuts unrelated to a language or country
|Google web search:
o (planet) are site namespaces. They are curated and here to find. (Pull requests are welcome.)
Currently, the following dictionary namespaces are defined:
|Online Latein Wörterbuch
|MDBG Chinese Dictionary
Uniqueness in a namespace
The namespaces you use are derived from your settings (settings wheel left of the input field). For instance, having set
- language: English
- country: Unites States
your namespaces will be:
Advanced (with your GitHub account)
Your namespaces are derived from your config.yml. With your personal configuration, you can use more than 3 namespaces. This can be useful when you like to use shortcuts from multiple languages and countries, e.g. dictionaries or public transport while travelling.
Priority of namespaces
The lower a namespace is in the
namespaces list, the higher it's precedence. This is similar to Object-oriented programming, when a method needs to be picked from inheriting classes.
So in the example before, shortcuts from
.us override those from
en, and both those from
Per-call namespace, also overrides
Let's say you have configured
language=en but this time, you want to search the German Wikipedia. In this case, call
NAMESPACE.. This namespace will then have the highest priority.
If that prefixed namespace happens to be a language or country namespace, it will also override the current language or country.
Example in detail
Let's assume we use Trovu with these settings:
Now we call this query:
Here, we add the namespace de. This means that for this very query
- the de namespace is added to the
namespaceslist, with the highest priority.
- Also, since
deis a language, the language setting is changed to
So this query is now processed as if the settings were:
Instead of the English Wikipedia (that would have been used with
language: en), the German Wikipedia is used, because
language is now set to
de, and the Wikipedia shortcut's URL is defined as
Had another shortcut
w 1 existed in namespace de, then this shortcut would have been called, because we had added these namespaces to the subscribed namespaces, with the highest priority.
Default language and country
Calling the homepage URL without any namespaces will set the default language and country based on navigator.language.