15 August 2010

Apple's Dictionary/Wikipedia Bug!

Update: Apple fixes Dictionary in 10.6.5, released today(10 Nov. 2010)!
Here is the File they changed:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/Resources/Wikipedia.wikipediadictionary/Contents/Info.plist

And What they changed in the Info.plist file:
<key>WikipediaDataURL</key>
<string>http://%@.wikipedia.org/w/index.php?title=%@&amp;useskin=monobook</string>
<key>WikipediaDataVariantURL</key>
<string>http://%@.wikipedia.org/w/index.php?title=%@&amp;variant=%@&amp;useskin=monobook</string>

I guess they liked my fix so much they decided to use it! And why couldn't they update this earlier?
====== End Update ======

Okay, I was about to post something completely different, but as I went to look up some information in Wikipedia (via Apple's Dictionary app) I ran into a snag. I could no longer scroll beyond the bottom of the window. (Ok you Mac users give it a try.)  I use Spotlight (command-space) then type in a word like "tree," select Definition and it brings up the Dictionary app. Now click on Wikipedia and you have some good info on trees except like I said you can't scroll any further down.

So, Why did this happen? Well, it's rather simple Wikipedia wanted to enhance/update their user interface. You can read about the changes here. No fault there, they have every right to innovate and improve. So now it's up to Apple to fix. "Well, what are they waiting for," you ask? That's a good question considering Wikipedia has been testing these changes since November 2009 and I'm sure Apple has known about it.

Alas, I guess it's up to the hackers and tech geeks to fix until the big companies decide it's important enough for them to do.

Here's the info and education on the fix:

Wikipedia default skin(look) was Monobook, their new one is Vector. If we modify the Dictionary's Wikipedia search string we can force it to use the old skin by adding useskin=monobook. (You can read more fun stuff to do with the search string @ MediaWiki.)

The file to change is deep in the system frameworks so be careful not to edit anything else or it could break something.

Warning: Edit the file at your own risk, I am not responsible if you break something!

The file: (starting from the root directory)
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/Resources/Wikipedia.wikipediadictionary/Contents/Info.plist

What to change:
<key>WikipediaDataURL</key>
<string>http://%@.wikipedia.org/wiki/%@</string>

To:
<key>WikipediaDataURL</key>
<string>http://%@.wikipedia.org/w/index.php?title=%@&amp;useskin=monobook</string>

The file (Info.plist) and the folder it's in (Contents) have read only privilege's, so if you really want to make the change and you don't know how you will have to look up file/folder permissions and how to change them on a mac. Good Luck!

Note (16 Oct. 2010):  I mentioned this in a comment below. If you decided to test out the URL in your browser you will get an error when using &amp; However Dictionary.app WILL crash if you only use &! 

19 comments:

  1. Yes if you test the URL in your browser and use & a m p ; you will get an error. But the app will crash if you use &. I assume when the app submits the url string it gets converted and works.

    ReplyDelete
  2. That does the trick, thanks a lot!!!

    ReplyDelete
  3. this patch doesnt work.

    dictionary still does not finish rendering a page —

    and scrolling is the only way to coerce it to continue (partially) rendering pane by pane.

    so why wouldnt this NOT work as expected?

    thanx.

    ReplyDelete
  4. Thanks a million. I used to use the Dictionary app all the time until this recent disaster. Your fix worked for me, and does finish rendering pages on my system, contra zahadum's comment. I can resize the window and see more of the page rendered and also scroll as I used to. Can't see why Apple didn't implement this fix.

    ReplyDelete
  5. Can't thank you enough, this fix works perfectly and fiddling around with permissions taught me a thing or two about my Mac's inner workings!

    ReplyDelete
  6. This fix causes Dictionary to crash. Editing Info.plist directly is probably a bad thing.

    ReplyDelete
  7. My system appears to have a different directory structure, so I could not apply that fix, but experimentation with the Appearance setting on Wikipedia showed the following, for me at least:

    Appearance Skin
    x Chick
    n Classic
    n Cologne Blue
    n Modern
    S MonoBook
    x MySkin
    n Nostalgia
    S Simple
    x Vector

    S - scroll bar
    x - no scroll bar
    n - not filtered of skin style, and no scroll bar

    ReplyDelete
  8. worked perfectly!! thanks so much for the fix.

    ReplyDelete
  9. Darrell Greenwood10/16/10, 4:14 PM

    Worked perfectly for me.

    string used was http://%@.wikipedia.org/w/index.php?title=%@&useskin=monobook

    NOT the string with the 'amp;' in it. (when I paste the string containing the 'amp;' in this comment, the 'amp;' disappears... which explains why smartassim's two strings are identical above)

    ReplyDelete
  10. Darrell Greenwood10/16/10, 4:42 PM

    I am retracting my comment above. On further testing Dictionary.app crashed consistently when looking up Wikipedia entries so I back out the modified Info.plist whereupon Dictionary.app became stable again.

    ReplyDelete
  11. This really is a fancy hack. Thanx a lot! To whom this trick didn't work: First it didn't work for me, too. I thought I'd lost all dictonaries, for except of one installed dicts the page was blank, not even "No entries found" appeared. Neither restoring the file, nor a restart changed a thing. I simply had to open the preferences, untick "Wikipedia", and retick it. The "lost" dicts were available again, and everything works perfectly now. I use the English and German version of Wikipedia and both run fine.

    ReplyDelete
  12. 10.6.5 fixes this :) no more need for the hack

    ReplyDelete
  13. Is there a similar fix for 10.5?

    ReplyDelete
    Replies
    1. The fix is the same for 10.5, and the file should be in the same place. If you cannot find the file or string to change let me know and I'll see what I can find

      Delete
    2. The folder you mentioned does not exist in 10.5

      Here is the tree from /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/Resources/

      ├── BridgeSupport
      │   ├── DictionaryServices.bridgesupport
      │   └── DictionaryServicesFull.bridgesupport
      ├── English.lproj
      │   └── DefaultDictionaries.plist
      ├── IDXDefaultProperty.plist
      ├── Info.plist
      ├── SubstituteCharacters.plist
      ├── Transform.xsl
      ├── TransformApp.xsl
      ├── TransformPanel.xsl
      ├── TransformSimpleText.xsl
      ├── WordEquivalence.dictionary
      │   └── Contents
      │   ├── Info.plist
      │   ├── Keyword.index
      │   ├── Keyword_aux.data
      │   └── version.plist
      └── version.plist

      Delete
    3. And here is Dictionary.app

      └── Contents
      ├── CodeResources
      ├── Info.plist
      ├── MacOS
      │   └── Dictionary
      ├── PkgInfo
      ├── Resources
      │   ├── BackArrow.tiff
      │   ├── Censor.xsl
      │   ├── Censor2.xsl
      │   ├── DefaultStyle.css
      │   ├── DefaultStyle_NoNS.css
      │   ├── DefaultTransformer.xsl
      │   ├── Dictionary.icns
      │   ├── DictionaryBrowser.scriptSuite
      │   ├── DictionaryFrameTemplate.txt
      │   ├── DisclosureDown.png
      │   ├── DisclosureUp.png
      │   ├── English.lproj
      │   │   ├── BrowserWindow.nib
      │   │   │   ├── classes.nib
      │   │   │   ├── info.nib
      │   │   │   └── keyedobjects.nib
      │   │   ├── ImageWindow.nib
      │   │   │   ├── classes.nib
      │   │   │   ├── info.nib
      │   │   │   └── keyedobjects.nib
      │   │   ├── InfoPlist.strings
      │   │   ├── Localizable.strings
      │   │   ├── MainMenu.nib
      │   │   │   ├── classes.nib
      │   │   │   ├── info.nib
      │   │   │   └── keyedobjects.nib
      │   │   ├── Preferences.nib
      │   │   │   ├── classes.nib
      │   │   │   ├── info.nib
      │   │   │   └── keyedobjects.nib
      │   │   └── ServicesMenu.strings
      │   ├── FontBigger.tiff
      │   ├── FontSmaller.tiff
      │   ├── ForwardArrow.tiff
      │   ├── GetPrefs.js
      │   ├── MainPageJavaScript.js
      │   ├── MainPageStyle.css
      │   ├── MainPageTemplate.txt
      │   ├── MainPageTransformer.xsl
      │   ├── OnlineDictionaryQueryTemplate.txt
      │   ├── OnlineDictionaryResultTemplate.txt
      │   ├── Search_SnapBack.tif
      │   ├── Search_SnapBackPressed.tif
      │   ├── SetPrefs.js
      │   ├── StartupPage.html
      │   ├── Wikipedia.privatedictionary
      │   │   └── Contents
      │   │   ├── Info.plist
      │   │   ├── Resources
      │   │   │   ├── English.lproj
      │   │   │   │   ├── Disclaimer.htm
      │   │   │   │   ├── WikipediaFooterTemplate.txt
      │   │   │   │   └── Wikipedia_prefs.htm
      │   │   │   ├── WikipediaErrorTemplate.txt
      │   │   │   ├── WikipediaResultTemplate.txt
      │   │   │   ├── WikipediaSupport.js
      │   │   │   ├── Wikipedia_prefs.plist
      │   │   │   ├── Wikipedia_prefs_other_language.plist
      │   │   │   ├── progress_indicator.gif
      │   │   │   └── user.css
      │   │   └── version.plist
      │   ├── empty_prefs.htm
      │   └── progress_indicator.gif
      ├── SharedSupport
      │   └── DictionaryPanel.app
      │   └── Contents
      │   ├── CodeResources
      │   ├── Info.plist
      │   ├── MacOS
      │   │   └── DictionaryPanel
      │   ├── PkgInfo
      │   ├── Resources
      │   │   ├── English.lproj
      │   │   │   ├── InfoPlist.strings
      │   │   │   ├── MainMenu.nib
      │   │   │   │   ├── classes.nib
      │   │   │   │   ├── info.nib
      │   │   │   │   └── keyedobjects.nib
      │   │   │   └── PopupWindow.nib
      │   │   │   ├── classes.nib
      │   │   │   ├── info.nib
      │   │   │   └── keyedobjects.nib
      │   │   ├── PopupStyle.css
      │   │   ├── PopupStyleExtra.css
      │   ├── _CodeSignature
      │   │   └── CodeResources
      │   └── version.plist
      ├── _CodeSignature
      │   └── CodeResources
      └── version.plist

      Delete
    4. After finally getting back to this I was able to find the Dictionary app on a 10.5 system. Unfortunately the links are hard coded into the executable itself. The only way to change it is to get ahold of the source code or decompile it and recompile it with the changes.

      Delete
    5. That's a shame! Thanks anyway - you still replied even though its been five years now. :)

      Delete
  14. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. dan holzmann wikipedia

    ReplyDelete