Skip to content

Downloading Dictionaries

ODict can load dictionaries from the remote registry as well as from local files. Remote names use the form dictionary/language, for example wiktionary/eng.

Terminal window
odict download wiktionary/eng

By default, downloaded dictionaries are cached in ODict’s config directory under dictionaries/<dictionary>/. The command stores the downloaded file as <language>.odict.

Use --output to choose a directory:

Terminal window
odict download wiktionary/eng --output ./dictionaries

Use --no-cache when you always want a fresh copy:

Terminal window
odict download wiktionary/eng --no-cache

Use --retries to control retry behavior for remote loads:

Terminal window
odict download wiktionary/eng --retries 5
use odict::OpenDictionary;
#[tokio::main]
async fn main() -> odict::Result<()> {
let dictionary = OpenDictionary::load("wiktionary/eng").await?;
println!("{:?}", dictionary.path());
Ok(())
}
use odict::{
download::DictionaryDownloader,
LoadOptions,
OpenDictionary,
};
let downloader = DictionaryDownloader::default()
.with_caching(false)
.with_out_dir("./dictionaries")
.with_retries(5);
let dictionary = OpenDictionary::load_with_options(
"wiktionary/eng",
LoadOptions::default().with_downloader(downloader),
)
.await?;