Repurposes Intelligent Input Method Bus (iBus) to intercept text entered into a field by a user, and insert translated text in it's place into any graphical application. Hence, this allows you as a user to enter text in a language you know, while the field gets the translated text. Useful when interacting with websites or agents in a foreign language.
See the software in action below:
The functionality will work in any GUI application which requests keyboard-input - browser, text-editors, mail-clients, chat-clients etc.
Setup requires the following:
- Compiler supporting C++17 or higher.
- slimt, which provides a commodity machine (most CPUs) inference engine for the neural models powering machine translation.
- ibus and GLIB 2.0 libraries (for GTK and iBus)
- yaml-cpp
Installing Dependencies On ArchLinux, dependencies can be installed by:
pacman -S ibus glib2
pacman -S yaml-cpp
For slimt, follow instructions in the
repository. Package management (models) is done by slimt, and
ibus-slimt-t8n
is downstream to slimt. The command-line that also manages
packages can be installed via PyPI and can operate standalone.
python3 -m pip install slimt
slimt ls
slimt download
Building from source Once things are in place, run the following steps to
build and install ibus-slimt-t8n
and associated files required for
integration into ibus.
# Configure.
cmake -B build -S .
# Build
cmake --build build --target all
# Install.
sudo cmake --build build --target install
# Install the project...
# -- Install configuration: "Release"
# -- Up-to-date: /usr/local/libexec/ibus-slimt-t8n
# -- Up-to-date: /usr/share/ibus/component/slimt-t8n.xml
# -- Up-to-date: /usr/local/share/icons/bergamot.png
First run For first time install:
- Restart GNOME (in case the entry does not appear among available input methods).
- Restart
ibus-daemon
(ibus-daemon -rXv
) so the ibus parent updates to be aware ofslimt-t8n.xml
and is capable of spawning the ibus engine (ibus-slimt-t8n
).
From time to time, you may configure ibus-slimt-t8n
using the script supplied
(scripts/ibus-slimt-t8n-configure.py
,
requires python and slimt
python package),
installed previously.
python3 scripts/ibus-slimt-t8n-configure.py \
--default browsermt/en-de-tiny \
--verify
The generated configuration is located at $HOME/.config/ibus-slimt-t8n.yml
which can be edited by hand to add your own models, as long the YAML remains
valid.
Related Projects
- bergamot-translator
- translateLocally
- slimt
- lemonade (This repository is a rebrand after reducing dependencies and using slimt).