-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing
mmaher88 edited this page Mar 9, 2026
·
1 revision
git clone https://github.com/mmaher88/laren.git
cd laren
cmake -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j$(nproc)
cd build && ctest --output-on-failurelaren/
├── src/
│ ├── util/ # Unicode, memory mapping (no deps)
│ ├── dict/ # Trie + dictionary loader
│ ├── core/ # Transliteration pipeline
│ │ ├── rule_engine.cpp # ⭐ Arabizi → Arabic mappings
│ │ ├── transliterator.cpp # Pipeline orchestration
│ │ └── ranker.cpp # Frequency-based ranking
│ └── engine/ # Fcitx5 integration
│ ├── laren_engine.cpp # Addon lifecycle
│ └── laren_state.cpp # Key handling, candidates, UI
├── data/
│ └── dictionary.tsv # 375k Arabic words
├── tests/ # GoogleTest unit tests
├── resources/ # Fcitx5 config files
└── pkg/ # Packaging (Arch, Fedora, Debian)
flowchart LR
A["Edit code"] --> B["Build"]
B --> C["Run tests"]
C --> D["Install .so"]
D --> E["Restart fcitx5"]
E --> F["Test live"]
style A fill:#e1f5fe
style F fill:#c8e6c9
# Build and install
cmake --build build -j$(nproc) && sudo cp build/src/laren.so /usr/lib/fcitx5/laren.so
# Restart fcitx5 (KDE Wayland)
killall fcitx5; sleep 1
qdbus6 org.kde.KWin /VirtualKeyboard org.kde.kwin.VirtualKeyboard.enabled false
sleep 1
qdbus6 org.kde.KWin /VirtualKeyboard org.kde.kwin.VirtualKeyboard.enabled trueEdit src/core/rule_engine.cpp. Mappings are defined in the RuleEngine() constructor:
// Single letter: first option is tried first
{"k", {ar::QAF, ar::KAF}},
// Digraph: consumed before single letters
{"sh", {ar::SHEEN}},
// Number mapping
{"7", {ar::HAA}},After adding mappings, run tests to verify:
cmake --build build && cd build && ctest --output-on-failureEdit data/dictionary.tsv (tab-separated: arabic_word\tfrequency):
كويس 5000
يلا 4500
Higher frequency = ranked higher in suggestions.
Use distrobox to test on multiple distros without VMs:
# Fedora
distrobox create --name test-fedora --image fedora:41
distrobox enter test-fedora
sudo dnf install cmake gcc-c++ fcitx5-devel
cmake -B /tmp/build -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTS=OFF
cmake --build /tmp/build
# Ubuntu
distrobox create --name test-ubuntu --image ubuntu:24.04
distrobox enter test-ubuntu
sudo apt install cmake g++ fcitx5-modules-dev libfcitx5core-dev
cmake -B /tmp/build -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTS=OFF
cmake --build /tmp/buildPackaging files live in pkg/:
| File | Target |
|---|---|
pkg/arch/PKGBUILD |
AUR (Arch, CachyOS, Manjaro) |
pkg/fedora/fcitx5-laren.spec |
Fedora COPR |
pkg/debian/control |
Ubuntu PPA / Debian |