A bash script to translate text using rofi.
Translation | |
---|---|
Input | Description |
en:es text | Override default SOURCE and TARGET |
:en text | Auto-detect SOURCE; translate into English |
text | Translate with defaults |
Actions | |
Keyword | Description |
!e word | show examples for "word" |
!s text | speak the "text" |
!! | show last translation |
!!e | show examples for last translation |
!!s | speak last translation |
! | select and translate from history |
!d | select and delete from history |
!dd | clear history (in delete mode) |
? | display usage |
- Launch rofitr:
$ rofitr
- Translate into Russian:
$ rofitr :ru text
- Translate from primary selection (clipboard):
$ rofitr -s
- rofi
- crow-translate
- Basic Linux utilities
Edit script to change default translation options or pass them from command line:
SOURCE=en TARGET=ru rofitr
Following options are configurable:
## Set defaults
# SOURCE="en" # source language code
# TARGET="es" # translation language code
# ENGINE="google" # google, yandex or bing
# LOCALE="en" # translator language ($LANG var. by default)
# SPEAK_SOURCE="false" # speak the source (true/false)
# SPEAK_TRANSLATION="false" # speak the translation (true/false)
## Rofi general options
# leave these empty or comment out to use system defaults:
FONT="mono 10"
WIDTH="60"
LOCATION="2"
YOFFSET="20"
# use alternative config and theme
# CONFIG="~/.config/rofi/translate-config.rasi"
# THEME="/usr/share/rofi/themes/lb.rasi"
## Rofi required options
HIST_LINES="15" # lines to show for history mode
RES_LINES="42" # limit output to screen height
PROMPT_TR=" translate"
PROMPT_HIST=" history"
PROMPT_DEL=" delete"
CLR_RESULT="#ebdbb2" # text color for translation
CLR1="#b8bb26"
CLR2="#1d2021"