Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Local macOS dictionary as a source #1

Open
Rican7 opened this issue Mar 22, 2018 · 3 comments
Open

Feature - Local macOS dictionary as a source #1

Rican7 opened this issue Mar 22, 2018 · 3 comments

Comments

@Rican7
Copy link
Owner

Rican7 commented Mar 22, 2018

Currently, define uses all remote (online) sources. A local, expandable dictionary is available on macOS, which would be a great source if it was accessible.

Unfortunately, it seems that the only way to access the dictionary's data is through Core Services, which would require Cocoa bindings to Go and native-compilation (think cgo). There may be another way around this, though.

Also, the only public APIs that exist return the definition in a formatted string format, not in a structured model, which would be a nightmare (if not potentially impossible) to consistently parse.

More information here (for later reference):

@Rican7
Copy link
Owner Author

Rican7 commented Jul 26, 2020

is it possible to make an offline copy if these online sources?

An offline copy of the entirety of a language dictionary? Not that I know of.

If it was possible, it'd likely be expensive (API calls), or massive.

@earthboundkid
Copy link

On my computer, if I load ~/Library/Caches/com.apple.DictionaryServices/DictionaryCache.plist it looks like this:

image

The first dictionary is one I installed myself. Looking at the next one:

$ tree $(pbpaste)
/System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/1700888691b981116bc46e57553cf4e4f41f2bc3.asset/AssetData/Traditional\ Chinese\ -\ English\ Idioms.dictionary
└── Contents
    ├── Info.plist
    └── Resources
        ├── Body.data
        ├── DefaultStyle.css
        ├── EntryID.data
        ├── EntryID.index
        ├── KeyText.data
        ├── KeyText.index
        ├── ar.lproj
        │   └── InfoPlist.strings
        ├── ca.lproj
        │   └── InfoPlist.strings
        ├── cs.lproj
        │   └── InfoPlist.strings
        ├── da.lproj
        │   └── InfoPlist.strings
        ├── de.lproj
        │   └── InfoPlist.strings
        ├── el.lproj
        │   └── InfoPlist.strings
        ├── en.lproj
        │   └── InfoPlist.strings
        ├── en_AU.lproj
        │   └── InfoPlist.strings
        ├── en_GB.lproj
        │   └── InfoPlist.strings
        ├── es.lproj
        │   └── InfoPlist.strings
        ├── es_419.lproj
        │   └── InfoPlist.strings
        ├── fi.lproj
        │   └── InfoPlist.strings
        ├── fr.lproj
        │   └── InfoPlist.strings
        ├── fr_CA.lproj
        │   └── InfoPlist.strings
        ├── he.lproj
        │   └── InfoPlist.strings
        ├── hi.lproj
        │   └── InfoPlist.strings
        ├── hr.lproj
        │   └── InfoPlist.strings
        ├── hu.lproj
        │   └── InfoPlist.strings
        ├── id.lproj
        │   └── InfoPlist.strings
        ├── it.lproj
        │   └── InfoPlist.strings
        ├── ja.lproj
        │   └── InfoPlist.strings
        ├── ko.lproj
        │   └── InfoPlist.strings
        ├── ms.lproj
        │   └── InfoPlist.strings
        ├── nl.lproj
        │   └── InfoPlist.strings
        ├── no.lproj
        │   └── InfoPlist.strings
        ├── pl.lproj
        │   └── InfoPlist.strings
        ├── pt.lproj
        │   └── InfoPlist.strings
        ├── pt_PT.lproj
        │   └── InfoPlist.strings
        ├── ro.lproj
        │   └── InfoPlist.strings
        ├── ru.lproj
        │   └── InfoPlist.strings
        ├── sk.lproj
        │   └── InfoPlist.strings
        ├── sv.lproj
        │   └── InfoPlist.strings
        ├── th.lproj
        │   └── InfoPlist.strings
        ├── tr.lproj
        │   └── InfoPlist.strings
        ├── uk.lproj
        │   └── InfoPlist.strings
        ├── vi.lproj
        │   └── InfoPlist.strings
        ├── zh_CN.lproj
        │   └── InfoPlist.strings
        ├── zh_HK.lproj
        │   └── InfoPlist.strings
        └── zh_TW.lproj
            └── InfoPlist.strings

41 directories, 46 files

Poking around online, it seems like these dictionaries were originally plain XML, and then at some point Apple changed it to being a custom compressed format. Some put an old version of Apple's Dictionary Development Kit on Github: https://github.com/SebastianSzturo/Dictionary-Development-Kit Maybe looking a that would tell you how to open the .data files.

@gedw99
Copy link

gedw99 commented Mar 3, 2023

Yeah it would be cool if local dictionaries were accessible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants