Giter Club home page Giter Club logo

crow-translate's Introduction

Crow Translate logo Crow Translate

GitHub (pre-)release Codacy grade

Crow Translate is a simple and lightweight translator programmed in C++ / Qt that allows to translate and speak text using Google, Yandex and Bing translate API. You may also be interested in my library QOnlineTranslator used in this project.

Content

Screenshots

Linux KDE

Main screenshot Popup screenshot Sentense screenshot Settings screenshot

Screenshots: OS: Arch Linux | Desktop environment: Plasma | Theme: Breeze | Icons: Papirus | Wallpaper: Catalina

Windows 10

Main screenshot Popup screenshot Sentense screenshot Settings screenshot

Screenshots: OS: Windows 10 | Theme: default | Wallpaper: WallpapersCraft

Features

  • Translate and speak text in any application that supports text selection
  • Support 117 different languages
  • Low memory consumption (~20MB)
  • Highly customizable shortcuts
  • Command-line interface with rich options
  • D-Bus API
  • Available for Linux and Windows

Default keyboard shortcuts

You can change them in the settings. Some key sequences may not be available due to OS limitations.

Wayland does not support global shortcuts registration, but you can use D-Bus to bind actions in the system settings. For desktop environments that support additional applications actions (KDE, for example) you will see them predefined in the system shortcut settings. You can also use them for X11 sessions, but you need to disable global shortcuts registration in the application settings to avoid conflicts.

Global

Key Description
Ctrl + Alt + E Translate selected text
Ctrl + Alt + S Speak selected text
Ctrl + Alt + F Speak translation of selected text
Ctrl + Alt + G Stop speaking
Ctrl + Alt + C Show main window

In main window

Key Description
Ctrl + Return Translate
Ctrl + Q Close window
Ctrl + S Speak source / pause text speaking
Ctrl + Shift + S Speak translation / pause text speaking
Ctrl + Shift + C Copy translation to clipboard

CLI commands

The program also has a console interface.

Usage: crow [options] text

Option Description
-h, --help Display help
-v, --version Display version information
-c, --codes Display language codes
-a, --audio-only Print text only for speaking when using --speak-translation or --speak-source
-s, --source <code> Specify the source language (by default, engine will try to determine the language on its own)
-t, --translation <code> Specify the translation language(s), splitted by '+' (by default, the system language is used)
-l, --locale <code> Specify the translator language (by default, the system language is used)
-e, --engine <engine> Specify the translator engine ('google', 'yandex' or 'bing'), Google is used by default
-p, --speak-translation Speak the translation
-u, --speak-source Speak the source
-f, --file Read source text from files. Arguments will be interpreted as file paths
-i, --stdin Add stdin data to source text

Note: If you do not pass startup arguments to the program, the GUI starts.

D-Bus API

Currently available only for global shortcuts.

io.crow_translate.CrowTranslate
└── /io/crow_translate/CrowTranslate/MainWindow
    ├── method void io.crow_translate.CrowTranslate.MainWindow.copyTranslatedSelection()
    ├── method void io.crow_translate.CrowTranslate.MainWindow.open()
    ├── method void io.crow_translate.CrowTranslate.MainWindow.speakSelection()
    ├── method void io.crow_translate.CrowTranslate.MainWindow.speakTranslatedSelection()
    ├── method void io.crow_translate.CrowTranslate.MainWindow.stopSpeaking()
    ├── method void io.crow_translate.CrowTranslate.MainWindow.translateSelection()
    └── method void io.crow_translate.CrowTranslate.MainWindow.quit()

For example, you can show main window using dbus-send:

dbus-send --type=method_call --dest=io.crow_translate.CrowTranslate /io/crow_translate/CrowTranslate/MainWindow io.crow_translate.CrowTranslate.MainWindow.open

Or via qdbus:

qdbus io.crow_translate.CrowTranslate /io/crow_translate/CrowTranslate/MainWindow io.crow_translate.CrowTranslate.MainWindow.open
# or shorter
qdbus io.crow_translate.CrowTranslate /io/crow_translate/CrowTranslate/MainWindow open

Dependencies

Arch Linux packages

Build: qt5-base qt5-multimedia qt5-x11extras qt5-tools

Run: qt5-base qt5-multimedia qt5-x11extras gst-plugins-good openssl

Debian packages

Build: qt5-default qt5-qmake libqt5x11extras5-dev qttools5-dev-tools qtmultimedia5-dev qtbase5-dev qtbase5-dev-tools

Run: gstreamer1.0-fluendo-mp3 qtgstreamer-plugins-qt5 gstreamer1.0-plugins-good gstreamer1.0-alsa gstreamer1.0-pulseaudio libqt5multimedia5-plugins

openSUSE packages

Build: gcc-c++ libqt5-linguist-devel libqt5-qtbase-devel libqt5-qtmultimedia-devel libqt5-qtx11extras-devel

Solus packages

Build: qt5-tools-devel qt5-multimedia-devel qt5-svg-devel qt5-x11extras-devel

Run: qt5-base qt5-x11extras qt5-multimedia libstdc++ libgcc glibc libx11

Third-party

Libraries

This project uses the following third-party libraries:

  • QOnlineTranslator - provides free usage of Google, Yandex and Bing translate API.
  • QGitTag - uses the GitHub API to provide information about releases.
  • QHotkey - provides global shortcuts for desktop platforms.
  • QTaskbarControl - allows to create a taskbar/launcher progress for all desktop platforms.
  • SingleApplication - prevents launch of multiple application instances.

Therefore, if you want to clone this project, you need to use the --recursive option:

git clone --recursive [email protected]:crow-translate/crow-translate.git

or you can initialize these modules later:

git clone [email protected]:crow-translate/crow-translate.git
git submodule init
git submodule update

Icons

Only Linux supports icon theming. Windows use Papirus icons.

FlagKit icons are used for flags.

Installation

Windows

📦 Releases page

📦 Scoop package

sudo scoop install crow-translate -g

Linux

Arch Linux, Manjaro, Chakra, etc

📦 Stable version in AUR

git clone https://aur.archlinux.org/crow-translate.git
cd crow-translate
makepkg -si

📦 Git version in AUR

git clone https://aur.archlinux.org/crow-translate-git.git
cd crow-translate-git
makepkg -si

Debian, Ubuntu, Mint, etc

📦 Releases page

Fedora

📦 Fedora Copr

sudo dnf copr enable faezebax/crow-translate
sudo dnf install crow-translate

CentOS, RHEL

📦 Fedora Copr

sudo yum copr enable faezebax/crow-translate
sudo yum install crow-translate

openSUSE Tumbleweed

📦 Tumbleweed repository

sudo zypper install crow-translate

openSUSE Leap

📦 Open Build Service

Solus

📦 Solus repository

sudo eopkg it crow-translate

Building

Automatic script

You can use the automatic script that builds Crow Translate and creates a package for your distribution:

cd dist/unix
./create-package.sh

Than you can install it as usual. The script will tell you where the package will be after the making. Currently, only Arch Linux, Debian and their derivatives are supported.

Manual building

You can build Crow Translate by using the following commands:

qmake # Or qmake-qt5 in some distributions
make
make clean

You will then get a binary named crow.

Build parameters

  • PORTABLE_MODE - Enable portable functionality. If you create file named settings.ini in the app folder and Crow will store the configuration in it. It also adds the “Portable Mode” option to the application settings, which does the same.

Build parameters are passed at the qmake stage: qmake "DEFINES += PORTABLE_MODE".

Localization

To help with localization you can use Transifex or translate files in data/translations with Qt Linguist directly. To add a new language, make a request on the Transifex page or copy data/translations/crow.ts to data/translations/crow_<ISO 639-1 language code>.ts, translate it and send a pull request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.