Jump to content

Wiktionary/Look Up tool

From Meta, a Wikimedia project coordination wiki
Other languages:
English · Acèh · Ænglisc · Afrikaans · aragonés · asturianu · Avañe'ẽ · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · Basa Bali · 閩南語 / Bân-lâm-gú · Bikol Central · Boarisch · brezhoneg · català · čeština · corsu · Cymraeg · dansk · Deutsch · eesti · English · español · Esperanto · euskara · føroyskt · français · Frysk · Fulfulde · Gaelg · Gaeilge · Gagana Samoa · galego · Hawaiʻi · hornjoserbsce · Ido · interlingua · Interlingue · íslenska · italiano · kurdî · Ladino · la .lojban. · latviešu · Lëtzebuergesch · lietuvių · Limburgs · Lingua Franca Nova · magyar · Malagasy · Malti · Minangkabau · Mirandés · Na Vosa Vakaviti · Nederlands · norsk bokmål · Norfuk / Pitkern · occitan · Oromoo · polski · português · português do Brasil · Qaraqalpaqsha · română · Runa Simi · sardu · Scots · sicilianu · slovenčina · slovenščina · Sunda · svenska · suomi · Tiếng Việt · Türkçe · Türkmençe · vèneto · Volapük · walon · Zazaki · Ἀρχαία ἑλληνικὴ · Ελληνικά · беларуская · беларуская (тарашкевіца) · български · ирон · кыргызча · қазақша · македонски · монгол · русский · татарча / tatarça · алтай тил · українська · მარგალური · ქართული · հայերեն · अंगिका · डोटेली · नेपाली · भोजपुरी · मराठी · मैथिली · हिन्दी · বাংলা · ਪੰਜਾਬੀ · ଓଡ଼ିଆ · ગુજરાતી · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · ꯃꯤꯇꯩ ꯂꯣꯟ · ไทย · ཇོང་ཁ · བོད་ཡིག · ဖၠုံလိက် · ဘာသာမန် · မြန်မာဘာသာ · ᬩᬲᬩᬮᬶ · ᱥᱟᱱᱛᱟᱲᱤ · ⵜⴰⵎⴰⵣⵉⵖⵜ · ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ · አማርኛ · 한국어 · 日本語 · 中文 · 粵語 · עברית · ئۇيغۇرچە · العربية · ئۇيغۇرچە / Uyghurche · اردو · الدارجة · پښتو · تۆرکجه · سنڌي · سرائیکی · فارسی · کوردی · مصرى · ދިވެހިބަސް · ߒߞߏ
Screenshot of a definition given with the Look Up tool from the French Wiktionary

The Wiktionary Look Up tool is a javascript which allows readers to simply double-click on a term to receive a pop-up with the top definition for the term, without leaving the page they are reading. It's particularly useful when visiting a site not in your first language, but great whenever you run across a term you're not quite certain about.

If you had used the double click option to edit a page, this can still be utilised by "SHIFT double click". You can also look up a word by highlighting it and pressing ctrl+shift+L (useful in languages that don't use spaces, like Chinese, or if you want to look up a word like sans serif).

Available languages

[edit]
Wiktionary look up (on French wikinews) also gives the Japanese definitions
  Extract Wiktionaries
English Extract local code
Español Extract local code
Français Extract local code
Italiano Extract local code
日本語 Extract local code
Nederlands Extract local code
Português Extract local code
Русский Extract local code
தமிழ் Extract local code

Local Wiktionaries features

[edit]
  • The projects feedback could be integrated to the code as the Italian one.

Configuration options

[edit]

There is a number of configuration options. These should be added to special:mypage/monobook.js (replace monobook with your skin if you don't use monobook).

Looking up the word government with the following configuration:
 if (!window.wiktLookup) wiktLookup = {};
 wiktLookup.count = 3;
 wiktLookup.showWord = 'bold';
 wiktLookup.mode='bottom';

The following parameters are supported (prefix with wiktLookup.)

  • count - maximun number of definitions to display (defaults to 1; values other than 1 not well tested. Will only display a maximun of the number of definitions it can find.)
  • showWord - show the word that this definition is for. (use one of link, none, or bold. defaults to none)
  • noRedir - disable auto-redirection. for example disable mapping FOOD → food (not recomended).
  • preferLang - this is your user language. This is the language that the definition appears in (not the language that the word is assumed to be of) (don't mess with this unless you have a good reason. defaults to your mediawiki preference)
  • audio - One of true, false, autoplay. have audio pronounciation of word where available. Work in English and French.
  • height - how many pixels high the maximun size of the box should be. defaults to about 420
  • width - how many pixels wide the max size of box should be. defaults 180.
  • key - a single (lowercase) letter to specify the ctrl+shift+key combo. for example if you put wiktLookup.key = 'b', ctrl+shift+b will look up any word thats highlighted. defaults to 'l'. Note: sometimes the box will popup in weird places when looking up things by key combo.
  • reverseShift - Normally if you press shift, it stops the popup from coming up when double clicking. with this option, you have to press shift and double click for the pop up to come up.
  • exit - true or false (Default false). have a hide link on the popup.
  • disableByDefault true or false (default false). When enabled, only enable for sections enclosed by an element with a class name of wiktLookup-enable (ex <span class="wiktLookup-enable"> foo bar baz </span>). Note, the class name wiktLookup-disable is also recognized to disable looking up words on double click.

For example, to use a count of 3 defintions, the bold showWord, a slightly wider box, add the following js:

if (!window.wiktLookup) wiktLookup = {};
wiktLookup.count = 3;
wiktLookup.showWord = 'bold';
wiktLookup.width = 220;

If you want disable this script you could use the code var disableWiktLookup = true; in case where the script is on the commons.js.

If you are on a wiki, you would either add it to special:mypage/monobook.js (replacing monobook with the skin you use) if you just want it for you, or mediawiki:Common.js if you want the options. If you are using an external website, such as blog, you would suround it with <script> tags, and insert it into the html source of your website.

If you are using this from a blog (not a wiki), you can also use the global variable wgContentLanguage to overide the assumed content language of your blog (it defaults to the lang attribute of the html element) This is used to figure out what language the word you clicked on is in. The global variable wgUserLanguage controls what language it is assumed the user speaks (aka what language to present the definition in).

Feedback

[edit]

This tool is currently developed on English Wikinews. Please feedback on n:en:MediaWiki_talk:Gadget-dictionaryLookupHover.js. If you wish to use this an your personal website (on a blog or something), see here.

Bookmarklet

[edit]

This script can also be used as a bookmarklet. Bookmark the following url: javascript:(function%20()%20%7Bvar%20src%20=%20document.createElement('script');src.type%20=%20'text/javascript';src.src%20=%20'http://en.wikinews.org/w/index.php?title=MediaWiki:WiktionaryLookup-external-bookmarklet.js&action=raw&ctype=text/javascript&scrver=1';document.getElementsByTagName('head')%5B0%5D.appendChild(src);%7D)();void%200

Where can I see it in action?

[edit]

The Wiktionary Look Up tool is enabled by default on the French Wikinews and Wikiversity (a gadget could disable it). It is a gadget on the