Skip to content

Latest commit

 

History

History
91 lines (64 loc) · 2.02 KB

README.md

File metadata and controls

91 lines (64 loc) · 2.02 KB

Rofi translate

Simple rofi script for translation based on translate shell

Demo

Brief mode

Brief translation, provide simple translation with pronunciation audio.

Demo1

Verbose mode

Provide detail of specific translation

Demo2

Requirement

Archlinux

sudo pacman -S translate-shell rofi mplayer

Install

Download rofi-translate

git clone https://github.com/garyparrot/rofi-translate
cd rofi-translate

Configure environment variables

Edit .xprofile, add the following line.

export PATH=~/rofi-translate:$PATH

Usage

shell

$ rofi_trans
$ rofi_trans brief
$ rofi_trans verbose
$ rofi_trans delete

Add key binding for i3-wm

bindsym $mod+t exec rofi_trans

Configuration of rofi-translate

Open the file rofi_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/.rofi_trans"

    # Directory for cache audio files
    export transAudioCacheDir="$HOME/.rofi_trans_audio"

    # target language for translation
    export transTarget="zh-TW"

    # 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 rofi flash(close and open)
    export auto_refresh="1"

    export version=1
}