Skip to content

Aliases and Loading

Aliases give a dictionary a short local name. They are useful when a command or application repeatedly loads the same .odict file.

Terminal window
odict alias set animals ./animals.odict

Use the alias anywhere a dictionary path is accepted:

Terminal window
odict lookup animals cat
odict search animals "domesticated mammal" --index

alias add fails if the alias already exists. alias set creates or replaces it.

Terminal window
odict alias add animals ./animals.odict
odict alias set animals ./updated-animals.odict
odict alias delete animals

When ODict loads a dictionary by name, it checks sources in this order:

StepSourceExample
1Remote dictionary namewiktionary/eng
2Aliasanimals
3Local path./animals.odict

Remote dictionary names must use lowercase dictionary/language format. If the name is not a valid remote name, ODict continues to alias and path loading.

Aliases are stored in aliases.json inside ODict’s config directory. Remote downloads are cached beneath the same config directory by default.

In code, set a custom config directory when you need predictable writable paths:

use odict::{LoadOptions, OpenDictionary};
let dictionary = OpenDictionary::load_with_options(
"animals",
LoadOptions::default().with_config_dir("./config"),
)
.await?;

Use aliases for local workflows, scripts, and development machines where the dictionary path is stable for one user. For reproducible builds, CI, and deployed services, pass an explicit path or download directory so the environment is clear.