Configuration

The only configuration emtranslator uses is the user dictionary: a flat table of English-to-Monsu word pairs stored as a TOML file.

Location

  • User dictionary: ~/.config/neostore/emtranslator/config.toml
  • Legacy location (pre-migration): ~/.config/emtranslator/dictionary.json

The path is defined by the USER_DICTIONARY_PATH constant in src/emtranslator/dictionary.py and can be overridden via the user_dict_path argument of Translator(...).

Format

Dictionary files are flat TOML tables. Both keys and values are double-quoted strings:

"hello" = "monsu_1"
"hi" = "monsu_91"

Comments and blank lines are ignored. Keys without quotes (bare TOML keys) are also accepted. The writer sorts entries alphabetically; the parser does not care about order.

How dictionaries combine

When translating, words are looked up in this order of precedence:

  1. Custom dictionary passed to Translator(dictionary=...) or emtrans -d FILE.
  2. The persisted user dictionary (~/.config/neostore/emtranslator/config.toml).
  3. The built-in DEFAULT_DICTIONARY.

Later items override earlier ones, so a word in the user dictionary overrides the built-in entry with the same key.

Adding entries

From the CLI (persists to the user dictionary):

emtrans add hola monsu_91

To a project-local file instead:

emtrans add hola monsu_91 -d ./project.toml
emtrans -d ./project.toml "hola"   # use the file for a single command

From Python:

from emtranslator import Translator

t = Translator()
t.add_word("hola", "monsu_91")          # persisted
t.add_word("hola", "monsu_91", persist=False)  # in-memory only

Migration from the legacy layout

Older versions stored the user dictionary as JSON at ~/.config/emtranslator/dictionary.json. The first time the user dictionary is loaded at the new location, migrate_user_dictionary() copies the entries to ~/.config/neostore/emtranslator/config.toml. The migration is a one-time, non-destructive copy; the legacy file is left in place.

See also

Back to README