Simple wofi script for translation based on translate shell
Brief translation, provide simple translation with pronunciation audio.
Provide detail of specific translation
- wofi
- translate shell
- mplayer (without it you can't play the audio file)
- usleep
- awk
- sed
- tac
sudo pacman -S translate-shell wofi mplayer
git clone https://github.com/imsakg/wofi-translate.git
cd woif-translate
Edit .bashrc
, add the following line.
export PATH=~/wofi-translate:$PATH
shell
$ wofi_trans
$ wofi_trans brief
$ wofi_trans verbose
$ wofi_trans delete
Add key binding for i3-wm
bindsym $mod+t exec wofi_trans
Add key binding for hyprland
bind = SUPER SHIFT, T, exec, wofi_trans
Open the file wofi_trans
with your text editor.
Then make changes to these environment variables.
function Configs {
# the default translation engine for translate-shell.
export primary_translator="google"
# the alternative translation engine for translate-shell. Once the primary engine malfunctioned, the secondary engine replace it.
export secondary_translator="bing"
# the file use to storing your translating history.
export transHistory="$HOME/.wofi_trans"
# Directory for cache audio files
export transAudioCacheDir="$HOME/.wofi_trans_audio"
# target language for translation
export transTarget="en"
# transArgs: Arguement for translate shell
export transArgs="-b -speak"
# display some debug information, run it in shell so you can see it
export verbose="1"
# auto refresh the content of each mode after every operation, this will cause the wofi flash(close and open)
export auto_refresh="1"
export version=1
}